tls: WSAGetLastError should be used on Windows to check system socket error.

This commit is contained in:
Vic Lee 2014-04-29 23:05:30 +08:00
parent c8848fe4c8
commit 02595df976

View File

@ -431,7 +431,11 @@ int tls_read(rdpTls* tls, BYTE* data, int length)
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
#ifdef _WIN32
if (WSAGetLastError() == WSAEWOULDBLOCK)
#else
if ((errno == EAGAIN) || (errno == 0)) if ((errno == EAGAIN) || (errno == 0))
#endif
{ {
status = 0; status = 0;
} }
@ -580,7 +584,11 @@ BOOL tls_print_error(char* func, SSL* connection, int value)
return FALSE; return FALSE;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
#ifdef _WIN32
fprintf(stderr, "%s: I/O error: %d\n", func, WSAGetLastError());
#else
fprintf(stderr, "%s: I/O error: %s (%d)\n", func, strerror(errno), errno); fprintf(stderr, "%s: I/O error: %s (%d)\n", func, strerror(errno), errno);
#endif
tls_errors(func); tls_errors(func);
return TRUE; return TRUE;