peer discovery: add default port

This commit is contained in:
Adrien Béraud committed 2019-05-23 10:39:43 -04:00
1 parent e4516772ee
commit ff6be81929
2 files changed
+4 -4

No files matched your search

+3 -2
View File
@@ -31,9 +31,10 @@ namespace dht {
class OPENDHT_PUBLIC PeerDiscovery
{
public:
static constexpr in_port_t DEFAULT_PORT = 8888;
using ServiceDiscoveredCallback = std::function<void(msgpack::object&&, SockAddr&&)>;
PeerDiscovery(in_port_t port);
PeerDiscovery(in_port_t port = DEFAULT_PORT);
~PeerDiscovery();
/**
+1 -2
View File
@@ -38,7 +38,6 @@ namespace dht {
constexpr std::chrono::seconds DhtRunner::BOOTSTRAP_PERIOD;
static constexpr size_t RX_QUEUE_MAX_SIZE = 1024 * 16;
static constexpr std::chrono::milliseconds RX_QUEUE_MAX_DELAY(500);
static constexpr in_port_t PEER_DISCOVERY_PORT = 8888;
static const std::string PEER_DISCOVERY_DHT_SERVICE = "dht";
struct DhtRunner::Listener {
@@ -157,7 +156,7 @@ DhtRunner::run(const SockAddr& local4, const SockAddr& local6, const DhtRunner::
if (config.peer_discovery or config.peer_publish) {
peerDiscovery_ = context.peerDiscovery ?
std::move(context.peerDiscovery) :
std::make_shared<PeerDiscovery>(PEER_DISCOVERY_PORT);
std::make_shared<PeerDiscovery>();
}
auto netId = config.dht_config.node_config.network;