summaryrefslogtreecommitdiff
path: root/src/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network.cpp')
-rw-r--r--src/network.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/network.cpp b/src/network.cpp
index bd64e07..eab0f67 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -189,6 +189,9 @@ Server::Priv::~Priv()
finish = true;
}
+ if (sock >= 0)
+ shutdown(sock, SHUT_RDWR);
+
announceCondvar.notify_all();
threadListen.join();
threadAnnounce.join();
@@ -212,6 +215,8 @@ void Server::Priv::doListen()
(sockaddr *) &paddr, &addrlen);
if (ret < 0)
throw std::system_error(errno, std::generic_category());
+ if (ret == 0)
+ break;
buf.resize(ret);
auto & peer = getPeer(paddr);