From a5d1f698417dff4e470eb94c38ad6c4e5ebf38ff Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 18 May 2024 02:35:34 +0200 Subject: libstore: generatorize protocol serializers this is cursed. deeply and profoundly cursed. under NO CIRCUMSTANCES must protocol serializer helpers be applied to temporaries! doing so will inevitably cause dangling references and cause the entire thing to crash. we need to do this even so to get rid of boost coroutines, and likewise to encapsulate the serializers we suffer today at least a little bit to allow a gradual migration to an actual IPC protocol. (this isn't a problem that's unique to generators. c++ coroutines in general cannot safely take references to arbitrary temporaries since c++ does not have a lifetime system that can make this safe. -sigh-) Change-Id: I2921ba451e04d86798752d140885d3c5cc08e146 --- src/libstore/legacy-ssh-store.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstore/legacy-ssh-store.cc') diff --git a/src/libstore/legacy-ssh-store.cc b/src/libstore/legacy-ssh-store.cc index 57d333f12..e8394d805 100644 --- a/src/libstore/legacy-ssh-store.cc +++ b/src/libstore/legacy-ssh-store.cc @@ -185,7 +185,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor << printStorePath(info.path) << (info.deriver ? printStorePath(*info.deriver) : "") << info.narHash.to_string(Base16, false); - ServeProto::write(*this, *conn, info.references); + conn->to << ServeProto::write(*this, *conn, info.references); conn->to << info.registrationTime << info.narSize @@ -214,7 +214,7 @@ struct LegacySSHStore : public virtual LegacySSHStoreConfig, public virtual Stor conn->to << exportMagic << printStorePath(info.path); - ServeProto::write(*this, *conn, info.references); + conn->to << ServeProto::write(*this, *conn, info.references); conn->to << (info.deriver ? printStorePath(*info.deriver) : "") << 0 @@ -366,7 +366,7 @@ public: conn->to << ServeProto::Command::QueryClosure << includeOutputs; - ServeProto::write(*this, *conn, paths); + conn->to << ServeProto::write(*this, *conn, paths); conn->to.flush(); for (auto & i : ServeProto::Serialise::read(*this, *conn)) @@ -382,7 +382,7 @@ public: << ServeProto::Command::QueryValidPaths << false // lock << maybeSubstitute; - ServeProto::write(*this, *conn, paths); + conn->to << ServeProto::write(*this, *conn, paths); conn->to.flush(); return ServeProto::Serialise::read(*this, *conn); -- cgit v1.2.3