1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

RemoteStore: Close connection if an exception occurs

Fixes #2075.
This commit is contained in:
Eelco Dolstra 2018-10-16 23:36:15 +02:00
parent ba51100d64
commit 79e358ce6d
3 changed files with 121 additions and 63 deletions

View file

@ -97,6 +97,7 @@ public:
private:
Pool & pool;
std::shared_ptr<R> r;
bool bad = false;
friend Pool;
@ -112,7 +113,8 @@ public:
if (!r) return;
{
auto state_(pool.state.lock());
state_->idle.push_back(ref<R>(r));
if (!bad)
state_->idle.push_back(ref<R>(r));
assert(state_->inUse);
state_->inUse--;
}
@ -121,6 +123,8 @@ public:
R * operator -> () { return &*r; }
R & operator * () { return *r; }
void markBad() { bad = true; }
};
Handle get()