forked from lix-project/lix
Revert "libutil: remove Pool::Handle::bad"
This reverts commit792844fb86
. Change-Id:I3ca208b62edfd5cd1199478f75cd2edf19a364f6
This commit is contained in:
parent
0b8a17cab6
commit
52f741c23a
|
@ -155,6 +155,7 @@ void RemoteStore::setOptions(Connection & conn)
|
||||||
RemoteStore::ConnectionHandle::~ConnectionHandle()
|
RemoteStore::ConnectionHandle::~ConnectionHandle()
|
||||||
{
|
{
|
||||||
if (!daemonException && std::uncaught_exceptions()) {
|
if (!daemonException && std::uncaught_exceptions()) {
|
||||||
|
handle.markBad();
|
||||||
debug("closing daemon connection because of an exception");
|
debug("closing daemon connection because of an exception");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
private:
|
private:
|
||||||
Pool & pool;
|
Pool & pool;
|
||||||
std::shared_ptr<R> r;
|
std::shared_ptr<R> r;
|
||||||
|
bool bad = false;
|
||||||
|
|
||||||
friend Pool;
|
friend Pool;
|
||||||
|
|
||||||
|
@ -118,7 +119,7 @@ public:
|
||||||
if (!r) return;
|
if (!r) return;
|
||||||
{
|
{
|
||||||
auto state_(pool.state.lock());
|
auto state_(pool.state.lock());
|
||||||
if (!std::uncaught_exceptions())
|
if (!bad && !std::uncaught_exceptions())
|
||||||
state_->idle.push_back(ref<R>(r));
|
state_->idle.push_back(ref<R>(r));
|
||||||
assert(state_->inUse);
|
assert(state_->inUse);
|
||||||
state_->inUse--;
|
state_->inUse--;
|
||||||
|
@ -128,6 +129,8 @@ public:
|
||||||
|
|
||||||
R * operator -> () { return &*r; }
|
R * operator -> () { return &*r; }
|
||||||
R & operator * () { return *r; }
|
R & operator * () { return *r; }
|
||||||
|
|
||||||
|
void markBad() { bad = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
Handle get()
|
Handle get()
|
||||||
|
|
Loading…
Reference in a new issue