Skip to content
Snippets Groups Projects
Commit 6e10756e authored by Adrien Béraud's avatar Adrien Béraud
Browse files

peerdiscovery: cleanup

parent aad4ad03
Branches
Tags
No related merge requests found
...@@ -217,10 +217,8 @@ PeerDiscovery::listener_thread(PeerDiscoveredCallback callback) ...@@ -217,10 +217,8 @@ PeerDiscovery::listener_thread(PeerDiscoveredCallback callback)
{ {
int stopfds_pipe[2]; int stopfds_pipe[2];
#ifndef _WIN32 #ifndef _WIN32
auto status = pipe(stopfds_pipe); if (pipe(stopfds_pipe) == -1)
if (status == -1) {
throw std::runtime_error(std::string("Can't open pipe: ") + strerror(errno)); throw std::runtime_error(std::string("Can't open pipe: ") + strerror(errno));
}
#else #else
net::udpPipe(stopfds_pipe); net::udpPipe(stopfds_pipe);
#endif #endif
...@@ -304,7 +302,7 @@ PeerDiscovery::stop() ...@@ -304,7 +302,7 @@ PeerDiscovery::stop()
std::unique_lock<std::mutex> lck(mtx_); std::unique_lock<std::mutex> lck(mtx_);
running_ = false; running_ = false;
} }
cv_.notify_one(); cv_.notify_all();
if (stop_writefd_ != -1) { if (stop_writefd_ != -1) {
if (write(stop_writefd_, "\0", 1) == -1) { if (write(stop_writefd_, "\0", 1) == -1) {
perror("write"); perror("write");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment