Skip to content
Snippets Groups Projects
Unverified Commit d807af39 authored by Sébastien Blin's avatar Sébastien Blin Committed by GitHub
Browse files

Merge pull request #402 from MingruiZhangW/peerdiscovery_fix_bind

peerdiscovery: bind socket problem fix
parents b143bc45 29003700
Branches
No related tags found
No related merge requests found
...@@ -144,6 +144,8 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(sa_family_t domain, in_p ...@@ -144,6 +144,8 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(sa_family_t domain, in_p
: domain_(domain), port_(port), sockfd_(initialize_socket(domain)) : domain_(domain), port_(port), sockfd_(initialize_socket(domain))
{ {
socketJoinMulticast(sockfd_, domain); socketJoinMulticast(sockfd_, domain);
listener_setup();
sender_setup();
} }
PeerDiscovery::DomainPeerDiscovery::~DomainPeerDiscovery() PeerDiscovery::DomainPeerDiscovery::~DomainPeerDiscovery()
...@@ -262,7 +264,6 @@ PeerDiscovery::DomainPeerDiscovery::startDiscovery(const std::string &type, Serv ...@@ -262,7 +264,6 @@ PeerDiscovery::DomainPeerDiscovery::startDiscovery(const std::string &type, Serv
if (running_listen_.joinable()) if (running_listen_.joinable())
running_listen_.join(); running_listen_.join();
drunning_ = true; drunning_ = true;
listener_setup();
running_listen_ = std::thread(&DomainPeerDiscovery::listenerpack_thread, this); running_listen_ = std::thread(&DomainPeerDiscovery::listenerpack_thread, this);
} }
} }
...@@ -383,7 +384,6 @@ PeerDiscovery::DomainPeerDiscovery::startPublish(const std::string &type, const ...@@ -383,7 +384,6 @@ PeerDiscovery::DomainPeerDiscovery::startPublish(const std::string &type, const
if (running_send_.joinable()) if (running_send_.joinable())
running_send_.join(); running_send_.join();
lrunning_ = true; lrunning_ = true;
sender_setup();
running_send_ = std::thread([this](){ running_send_ = std::thread([this](){
std::unique_lock<std::mutex> lck(mtx_); std::unique_lock<std::mutex> lck(mtx_);
while (lrunning_) { while (lrunning_) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment