summaryrefslogtreecommitdiff
path: root/src/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network.cpp')
-rw-r--r--src/network.cpp10
1 files changed, 8 insertions, 2 deletions
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<NetworkProtocol::ProtocolClosed>(res))
break;
+ if (const auto * ann = get_if<NetworkProtocol::ReceivedAnnounce>(&res)) {
+ if (not isSelfAddress(ann->addr))
+ getPeer(ann->addr);
+ }
+
if (holds_alternative<NetworkProtocol::NewConnection>(res)) {
auto & conn = get<NetworkProtocol::NewConnection>(res).conn;
if (not isSelfAddress(conn.peerAddress()))
@@ -693,7 +698,8 @@ void Server::Peer::updateChannel(ReplyBuilder & reply)
if (!holds_alternative<Identity>(identity))
return;
- if (holds_alternative<monostate>(connection.channel())) {
+ if (holds_alternative<monostate>(connection.channel()) ||
+ holds_alternative<NetworkProtocol::Cookie>(connection.channel())) {
auto req = Channel::generateRequest(tempStorage,
server.self, std::get<Identity>(identity));
connection.channel().emplace<Stored<ChannelRequest>>(req);