diff options
author | eldritch horrors <pennae@lix.systems> | 2024-05-18 02:35:34 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-07-16 00:57:42 +0000 |
commit | a5d1f698417dff4e470eb94c38ad6c4e5ebf38ff (patch) | |
tree | 116b887a80fd96f9008bc55c872a24ef1955ca2f /src/nix-store/nix-store.cc | |
parent | 5271424d14241ec5cbe7ab3bda85ddeb486cff76 (diff) |
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
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r-- | src/nix-store/nix-store.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index f11e2fe4d..a2171a237 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -880,7 +880,8 @@ static void opServe(Strings opFlags, Strings opArgs) store->substitutePaths(paths); } - ServeProto::write(*store, wconn, store->queryValidPaths(paths)); + auto valid = store->queryValidPaths(paths); + wconn.to << ServeProto::write(*store, wconn, valid); break; } @@ -891,7 +892,7 @@ static void opServe(Strings opFlags, Strings opArgs) try { auto info = store->queryPathInfo(i); out << store->printStorePath(info->path); - ServeProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info)); + wconn.to << ServeProto::write(*store, wconn, static_cast<const UnkeyedValidPathInfo &>(*info)); } catch (InvalidPath &) { } } @@ -950,7 +951,7 @@ static void opServe(Strings opFlags, Strings opArgs) MonitorFdHup monitor(in.fd); auto status = store->buildDerivation(drvPath, drv); - ServeProto::write(*store, wconn, status); + wconn.to << ServeProto::write(*store, wconn, status); break; } @@ -959,7 +960,7 @@ static void opServe(Strings opFlags, Strings opArgs) StorePathSet closure; store->computeFSClosure(ServeProto::Serialise<StorePathSet>::read(*store, rconn), closure, false, includeOutputs); - ServeProto::write(*store, wconn, closure); + wconn.to << ServeProto::write(*store, wconn, closure); break; } |