diff --git a/components/net/cpp/src/universe.cpp b/components/net/cpp/src/universe.cpp index b78af39903a14d71a24cbc6aafc8820314efca43..130d7ec416f2022428435c901afcf78d6b85d426 100644 --- a/components/net/cpp/src/universe.cpp +++ b/components/net/cpp/src/universe.cpp @@ -6,6 +6,10 @@ #pragma comment(lib, "Rpcrt4.lib") #endif +#ifndef WIN32 +#include <signal.h> +#endif + using std::string; using std::vector; using std::thread; @@ -196,6 +200,9 @@ bool Universe::_subscribe(const std::string &res) { } void Universe::__start(Universe * u) { +#ifndef WIN32 + signal(SIGPIPE,SIG_IGN); +#endif // WIN32 u->_run(); } @@ -280,6 +287,7 @@ void Universe::_run() { } if (FD_ISSET(s->_socket(), &sfderror_)) { s->socketError(); + s->close(); } } else if (s != NULL) { // Erase it @@ -288,6 +296,7 @@ void Universe::_run() { if ((*i) == s) { LOG(INFO) << "REMOVING SOCKET"; peers_.erase(i); break; + // TODO Remove subscribers } } }