mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
peerdiscovery: flush stop socket if not stopping
This commit is contained in:
1 parent
453db29058
commit
b02e9cfff7
1 file changed
+5
-2
@@ -250,7 +250,10 @@ PeerDiscovery::listener_thread(PeerDiscoveredCallback callback)
|
||||
}
|
||||
|
||||
if (data_coming > 0) {
|
||||
if (FD_ISSET(stop_readfd, &readfds)) { break; }
|
||||
if (FD_ISSET(stop_readfd, &readfds)) {
|
||||
std::array<uint8_t, 64 * 1024> buf;
|
||||
recv(stop_readfd, buf.data(), buf.size(), 0);
|
||||
}
|
||||
|
||||
std::array<uint8_t,dht::InfoHash::size() + sizeof(in_port_t)> data_receive;
|
||||
size_t data_receive_size = data_receive.size();
|
||||
@@ -288,7 +291,7 @@ PeerDiscovery::startDiscovery(PeerDiscoveredCallback callback)
|
||||
}
|
||||
|
||||
void
|
||||
PeerDiscovery::startPublish(const dht::InfoHash &nodeId, in_port_t port_to_send)
|
||||
PeerDiscovery::startPublish(const dht::InfoHash& nodeId, in_port_t port_to_send)
|
||||
{
|
||||
sender_setup(nodeId, port_to_send);
|
||||
running_send = std::thread(&PeerDiscovery::sender_thread, this);
|
||||
|
||||
Reference in new issue
Block a user