Revert "libutil: remove Pool::Handle::bad"

This reverts commit 792844fb86.

Change-Id: I3ca208b62edfd5cd1199478f75cd2edf19a364f6
This commit is contained in:
eldritch horrors 2024-04-05 03:52:34 +02:00
parent 0b8a17cab6
commit 52f741c23a
2 changed files with 5 additions and 1 deletions

View file

@ -155,6 +155,7 @@ void RemoteStore::setOptions(Connection & conn)
RemoteStore::ConnectionHandle::~ConnectionHandle()
{
if (!daemonException && std::uncaught_exceptions()) {
handle.markBad();
debug("closing daemon connection because of an exception");
}
}

View file

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