From 81ea8bd5ceb3dcae6af0b79c81a39ecbf2ba97a8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 27 Mar 2018 22:16:01 +0200 Subject: Simplify the callback mechanism --- src/libstore/remote-store.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/libstore/remote-store.cc') diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index a157c6c48582..b72c940cdcf9 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -294,10 +294,9 @@ void RemoteStore::querySubstitutablePathInfos(const PathSet & paths, void RemoteStore::queryPathInfoUncached(const Path & path, - std::function)> success, - std::function failure) + Callback> callback) { - sync2async>(success, failure, [&]() { + try { auto conn(connections->get()); conn->to << wopQueryPathInfo << path; try { @@ -324,8 +323,8 @@ void RemoteStore::queryPathInfoUncached(const Path & path, info->sigs = readStrings(conn->from); conn->from >> info->ca; } - return info; - }); + callback(std::move(info)); + } catch (...) { callback.rethrow(); } } -- cgit 1.4.1