aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/legacy-ssh-store.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-04-05 03:52:23 +0200
committereldritch horrors <pennae@lix.systems>2024-04-05 20:13:02 +0000
commit0b8a17cab6d47c0abf1f604b6dbc6dc92553ed15 (patch)
treef39e813669e00b7a727323b12a57847f675e3af0 /src/libstore/legacy-ssh-store.cc
parentad3097286782e9773416a929badf54777d9861a1 (diff)
Revert "libstore: remove one Resource::good flag"
This reverts commit 87249eb579bf57f4f09e9fca100588a4d6b90b4c. Change-Id: Ide4c6e00c4155216a17e46671ff47151d7bb85b4
Diffstat (limited to 'src/libstore/legacy-ssh-store.cc')
-rw-r--r--src/libstore/legacy-ssh-store.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc
index e06d4e08d..2d8667a85 100644
--- a/src/libstore/legacy-ssh-store.cc
+++ b/src/libstore/legacy-ssh-store.cc
@@ -46,6 +46,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
FdSink to;
FdSource from;
ServeProto::Version remoteVersion;
+ bool good = true;
/**
* Coercion to `ServeProto::ReadConn`. This makes it easy to use the
@@ -96,7 +97,8 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
, host(host)
, connections(make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections),
- [this]() { return openConnection(); }
+ [this]() { return openConnection(); },
+ [](const ref<Connection> & r) { return r->good; }
))
, master(
host,
@@ -194,7 +196,12 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
<< info.ultimate
<< info.sigs
<< renderContentAddress(info.ca);
- copyNAR(source, conn->to);
+ try {
+ copyNAR(source, conn->to);
+ } catch (...) {
+ conn->good = false;
+ throw;
+ }
conn->to.flush();
} else {
@@ -202,7 +209,12 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor
conn->to
<< ServeProto::Command::ImportPaths
<< 1;
- copyNAR(source, conn->to);
+ try {
+ copyNAR(source, conn->to);
+ } catch (...) {
+ conn->good = false;
+ throw;
+ }
conn->to
<< exportMagic
<< printStorePath(info.path);