Permalink
Browse files

Fix "Error: Success" message in Csocket

When SSL remote closes socket without handshake.
Patch is submitted to upstream Csocket too.
  • Loading branch information...
1 parent e10b9a1 commit d0a3fddd6e820572e9f4b3a24e9e6ea2ed843c4b @DarthGandalf DarthGandalf committed Jun 16, 2013
Showing with 17 additions and 1 deletion.
  1. +17 −1 src/Csocket.cpp
View
@@ -2851,7 +2851,23 @@ void CSocketManager::Loop()
case Csock::READ_ERR:
{
- pcSock->CallSockError( GetSockError() );
+ bool bHandled = false;
+#ifdef HAVE_LIBSSL
+ if (pcSock->GetSSL()) {
+ unsigned long iSSLError = ERR_peek_error();
+ if (iSSLError) {
+ char szError[512];
+ memset(( char * ) szError, '\0', 512 );
+ ERR_error_string_n( iSSLError, szError, 511 );
+ SSLErrors(__FILE__, __LINE__);
+ pcSock->CallSockError(GetSockError(), szError);
+ bHandled = true;
+ }
+ }
+#endif
+ if (!bHandled) {
+ pcSock->CallSockError( GetSockError() );
+ }
DelSockByAddr( pcSock );
break;
}

0 comments on commit d0a3fdd

Please sign in to comment.