From 87d76df1720e29e4195cf4a8845c07450fb3b2f2 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 1 Aug 2023 11:38:26 -0700 Subject: Fixed issues around disconnected sockets. We were bailing out when sockets closed, that was silly. --- src/stable/sockettcp.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/stable/sockettcp.h') diff --git a/src/stable/sockettcp.h b/src/stable/sockettcp.h index 3fc14ef..8539b52 100644 --- a/src/stable/sockettcp.h +++ b/src/stable/sockettcp.h @@ -48,7 +48,14 @@ namespace Bu ... ... ... + // sigset is deprecated sigset( SIGPIPE, SIG_IGN ); // do this before you use a Bu::SocketTcp + + // this is the modern Linux alternative + struct sigaction saIgnore; + memset( &saIgnore, 0, sizeof(struct sigaction) ); + saIgnore.sa_handler = SIG_IGN; + sigaction( SIGPIPE, &saIgnore, NULL ); @endcode * When this is done, Bu::SocketTcp will simply throw a broken pipe * exception just like every other error condition, allowing your program -- cgit v1.2.3