diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-09-22 15:28:20 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-09-22 15:28:20 +0200 |
commit | 980edd1f3a31eefe297d073f6a7cff099f21eb4a (patch) | |
tree | 0df446e2b6e010b385fba1b315af659c7031e380 /src/libstore | |
parent | 5b107f2c5f5bb86042f9f65b022cf0ed0bfaccbd (diff) |
RemoteStore::addCAToStore(): Don't hold connection while calling queryPathInfo()
This leads to a deadlock if we're at the connection limit.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/remote-store.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 6f1f9769b..be5eb4736 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -541,7 +541,8 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore( const StorePathSet & references, RepairFlag repair) { - auto conn(getConnection()); + std::optional<ConnectionHandle> conn_(getConnection()); + auto & conn = *conn_; if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 25) { @@ -605,6 +606,8 @@ ref<const ValidPathInfo> RemoteStore::addCAToStore( } }, caMethod); auto path = parseStorePath(readString(conn->from)); + // Release our connection to prevent a deadlock in queryPathInfo(). + conn_.reset(); return queryPathInfo(path); } } |