Fixed bug on sock_read. It returns 0 when an error reading occurs, and this situation was not being controlled.

This commit is contained in:
Luis Angel Curiel Sanz
2013-04-19 08:39:59 +02:00
parent 6a5e1ac969
commit b41732ada7

View File

@@ -455,6 +455,12 @@ int tls_read(tls_t *tls, void * const buff, const size_t len)
bytes = sock_read(tls->sock, tls->recvbuffer + tls->recvbufferpos, bytes = sock_read(tls->sock, tls->recvbuffer + tls->recvbufferpos,
tls->recvbuffermaxlen - tls->recvbufferpos); tls->recvbuffermaxlen - tls->recvbufferpos);
if (bytes == 0)
{
tls->lasterror = WSAETIMEDOUT;
return -1;
}
if (bytes == -1) { if (bytes == -1) {
if (!tls_is_recoverable(sock_error())) { if (!tls_is_recoverable(sock_error())) {
tls->lasterror = sock_error(); tls->lasterror = sock_error();