tools/hexnet: Shut down connections when gracefully handling signals
parent
1d7e98d0b3
commit
a1ba08b7db
|
@ -114,6 +114,26 @@ void signalHandler(int signal) {
|
||||||
tcpSocket.shutdown(SHUT_RD);
|
tcpSocket.shutdown(SHUT_RD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tcpConnector) {
|
||||||
|
tcpConnector.shutdown(SHUT_RD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tcp6Socket) {
|
||||||
|
tcp6Socket.shutdown(SHUT_RD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tcp6Connector) {
|
||||||
|
tcp6Connector.shutdown(SHUT_RD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (udpSocket) {
|
||||||
|
udpSocket.shutdown(SHUT_RD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (udp6Socket) {
|
||||||
|
udp6Socket.shutdown(SHUT_RD);
|
||||||
|
}
|
||||||
|
|
||||||
std::cerr << "Received signal " << signal << ", bye!" << std::endl;
|
std::cerr << "Received signal " << signal << ", bye!" << std::endl;
|
||||||
std::exit(EXIT_SIGNAL);
|
std::exit(EXIT_SIGNAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue