Index: tlsIO.c ================================================================== --- tlsIO.c +++ tlsIO.c @@ -194,10 +194,11 @@ * *------------------------------------------------------------------- */ static int TlsInputProc(ClientData instanceData, char *buf, int bufSize, int *errorCodePtr) { + unsigned long backingError; State *statePtr = (State *) instanceData; int bytesRead; int tlsConnect; int err; @@ -255,13 +256,22 @@ case SSL_ERROR_SSL: Tls_Error(statePtr, TCLTLS_SSL_ERROR(statePtr->ssl, bytesRead)); *errorCodePtr = ECONNABORTED; break; case SSL_ERROR_SYSCALL: - dprintf("I/O error reading, treating it as EOF"); - *errorCodePtr = 0; - bytesRead = 0; + backingError = ERR_get_error(); + + if (backingError == 0 && err == 0) { + dprintf("EOF reached") + *errorCodePtr = 0; + bytesRead = 0; + } else { + dprintf("I/O error occured (backingError = %lu)", backingError); + *errorCodePtr = backingError; + bytesRead = 0; + } + break; } dprintf("Input(%d) -> %d [%d]", bufSize, bytesRead, *errorCodePtr); return(bytesRead);