forked from lix-project/lix
libstore: remove one Resource::good flag
usage of this flag previously kept connections open much longer than
necessary, and at the same time obscured that a connection was being
dropped when it *was* set. new variable names clarify this somewhat.
Change-Id: I11f6f08f37a5e4dc04ea6c6036ea589154b121c6
This commit is contained in:
parent
7f94f986d4
commit
0b77ba6980
|
@ -46,7 +46,6 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
||||||
FdSink to;
|
FdSink to;
|
||||||
FdSource from;
|
FdSource from;
|
||||||
ServeProto::Version remoteVersion;
|
ServeProto::Version remoteVersion;
|
||||||
bool good = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coercion to `ServeProto::ReadConn`. This makes it easy to use the
|
* Coercion to `ServeProto::ReadConn`. This makes it easy to use the
|
||||||
|
@ -97,8 +96,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
||||||
, host(host)
|
, host(host)
|
||||||
, connections(make_ref<Pool<Connection>>(
|
, connections(make_ref<Pool<Connection>>(
|
||||||
std::max(1, (int) maxConnections),
|
std::max(1, (int) maxConnections),
|
||||||
[this]() { return openConnection(); },
|
[this]() { return openConnection(); }
|
||||||
[](const ref<Connection> & r) { return r->good; }
|
|
||||||
))
|
))
|
||||||
, master(
|
, master(
|
||||||
host,
|
host,
|
||||||
|
@ -199,7 +197,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
||||||
try {
|
try {
|
||||||
copyNAR(source, conn->to);
|
copyNAR(source, conn->to);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
conn->good = false;
|
auto _dropConnDuringUnwind = std::move(conn);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
conn->to.flush();
|
conn->to.flush();
|
||||||
|
@ -212,7 +210,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
|
||||||
try {
|
try {
|
||||||
copyNAR(source, conn->to);
|
copyNAR(source, conn->to);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
conn->good = false;
|
auto _dropConnDuringUnwind = std::move(conn);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
conn->to
|
conn->to
|
||||||
|
|
Loading…
Reference in a new issue