From 0b6d3534741640419fa8489172d22e673fc018d7 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 21 Mar 2024 21:35:27 +0100 Subject: [PATCH] libutil: remove Pool::Handle::bad it was used incorrectly (not swapped on handle move), only used in one place (that is now handled with exception handling detection in Handle itself), and if ever reintroduced should be replaced with a different, more understandable mechanism (like an explicit dropAsInvalid method). Change-Id: Ie3e5d5cfa81d335429cb2ee5c3ad85c74a9df17b --- src/libstore/remote-store.cc | 1 - src/libutil/pool.hh | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 20c1c50f2..3188d9330 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -155,7 +155,6 @@ void RemoteStore::setOptions(Connection & conn) RemoteStore::ConnectionHandle::~ConnectionHandle() { if (!daemonException && std::uncaught_exceptions()) { - handle.markBad(); debug("closing daemon connection because of an exception"); } } diff --git a/src/libutil/pool.hh b/src/libutil/pool.hh index b7a749e3a..2f6d30130 100644 --- a/src/libutil/pool.hh +++ b/src/libutil/pool.hh @@ -103,7 +103,6 @@ public: private: Pool & pool; std::shared_ptr r; - bool bad = false; friend Pool; @@ -119,7 +118,7 @@ public: if (!r) return; { auto state_(pool.state.lock()); - if (!bad && !std::uncaught_exceptions()) + if (!std::uncaught_exceptions()) state_->idle.push_back(ref(r)); assert(state_->inUse); state_->inUse--; @@ -129,8 +128,6 @@ public: R * operator -> () { return &*r; } R & operator * () { return *r; } - - void markBad() { bad = true; } }; Handle get()