From d0c48bf9b90dfbd55908a88a5aba411ca9b8e600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 27 Aug 2023 21:52:29 +0200 Subject: Network: connection initiation with cookie --- src/network.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/network.cpp') diff --git a/src/network.cpp b/src/network.cpp index a3d1130..da480c3 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -221,7 +221,7 @@ bool Peer::send(UUID uuid, const Ref & ref, const Object & obj) const NetworkProtocol::Header::ServiceType { uuid }, NetworkProtocol::Header::ServiceRef { ref.digest() }, }); - speer->connection.send(speer->partStorage, header, { obj }, true); + speer->connection.send(speer->partStorage, move(header), { obj }, true); return true; } @@ -363,6 +363,11 @@ void Server::Priv::doListen() if (holds_alternative(res)) break; + if (const auto * ann = get_if(&res)) { + if (not isSelfAddress(ann->addr)) + getPeer(ann->addr); + } + if (holds_alternative(res)) { auto & conn = get(res).conn; if (not isSelfAddress(conn.peerAddress())) @@ -693,7 +698,8 @@ void Server::Peer::updateChannel(ReplyBuilder & reply) if (!holds_alternative(identity)) return; - if (holds_alternative(connection.channel())) { + if (holds_alternative(connection.channel()) || + holds_alternative(connection.channel())) { auto req = Channel::generateRequest(tempStorage, server.self, std::get(identity)); connection.channel().emplace>(req); -- cgit v1.2.3