Skip to content
Permalink
Browse files

dhtrunner/peerdiscovery: only advertise bound address families

  • Loading branch information...
aberaud committed Jun 10, 2019
1 parent 8942e0d commit 20c0069867562ec0ee0b3295f691b6e33c3e00d5
Showing with 12 additions and 8 deletions.
  1. +12 −8 src/dhtrunner.cpp
@@ -195,18 +195,22 @@ DhtRunner::run(const Config& config, Context&& context)
}
if (config.peer_publish) {
msgpack::sbuffer sbuf_node;
// IPv4
NodeInsertionPack adc;
adc.net = netId;
adc.port = getBoundPort(AF_INET);
adc.nodeId = dht_->getNodeId();
msgpack::pack(sbuf_node, adc);
peerDiscovery_->startPublish(AF_INET, PEER_DISCOVERY_DHT_SERVICE, sbuf_node);
// IPv4
if (auto bound4 = dht_->getSocket()->getBound(AF_INET)) {
adc.port = bound4.getPort();
msgpack::pack(sbuf_node, adc);
peerDiscovery_->startPublish(AF_INET, PEER_DISCOVERY_DHT_SERVICE, sbuf_node);
}
// IPv6
adc.port = getBoundPort(AF_INET6);
sbuf_node.clear();
msgpack::pack(sbuf_node, adc);
peerDiscovery_->startPublish(AF_INET6, PEER_DISCOVERY_DHT_SERVICE, sbuf_node);
if (auto bound6 = dht_->getSocket()->getBound(AF_INET6)) {
adc.port = bound6.getPort();
sbuf_node.clear();
msgpack::pack(sbuf_node, adc);
peerDiscovery_->startPublish(AF_INET6, PEER_DISCOVERY_DHT_SERVICE, sbuf_node);
}
}
}

0 comments on commit 20c0069

Please sign in to comment.
You can’t perform that action at this time.