From 14a47a31e9f07f260d18f0ce5d667674e5a99ed0 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 9 Nov 2004 17:41:53 +0000 Subject: [PATCH] partial fix for mantis entry 160 - the following message is avoided by shutting down the socket only if we are not certain if the errno is indicating that the circuit hung up. rsrv: socket shutdown error was Transport endpoint is not connected --- src/rsrv/caserverio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index ae4313f59..522d07dfb 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -78,6 +78,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) } } else { + int causeWasSocketHangup = 0; int anerrno = SOCKERRNO; char buf[64]; @@ -98,11 +99,14 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) ); - if ( (anerrno!=SOCK_ECONNABORTED&& - anerrno!=SOCK_ECONNRESET&& - anerrno!=SOCK_EPIPE&& - anerrno!=SOCK_ETIMEDOUT)|| - CASDEBUG>2){ + if ( + anerrno == SOCK_ECONNABORTED || + anerrno == SOCK_ECONNRESET || + anerrno == SOCK_EPIPE || + anerrno == SOCK_ETIMEDOUT ) { + causeWasSocketHangup = 1; + } + else { char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); @@ -116,7 +120,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) /* * wakeup the receive thread */ - { + if ( ! causeWasSocketHangup ) { enum epicsSocketSystemCallInterruptMechanismQueryInfo info = epicsSocketSystemCallInterruptMechanismQuery (); switch ( info ) {