Immanuel Gregoire made libssh2_packet_read() properly deal with blocks when
in non-blocking state. Until this fix, libssh2 just couldn't work properly on Windows while non-blocking.
Этот коммит содержится в:
родитель
46f26d3d0e
Коммит
80f6c7c6d1
@ -328,9 +328,28 @@ libssh2_packet_read(LIBSSH2_SESSION * session)
|
||||
PACKETBUFSIZE - remainbuf,
|
||||
LIBSSH2_SOCKET_RECV_FLAGS(session));
|
||||
if (nread <= 0) {
|
||||
/* check if this is due to EAGAIN and return
|
||||
the special return code if so, error out
|
||||
normally otherwise */
|
||||
/* check if this is due to EAGAIN and return the special
|
||||
return code if so, error out normally otherwise */
|
||||
#ifdef WIN32
|
||||
switch (WSAGetLastError()) {
|
||||
case WSAEWOULDBLOCK:
|
||||
errno = EAGAIN;
|
||||
break;
|
||||
|
||||
case WSAENOTSOCK:
|
||||
errno = EBADF;
|
||||
break;
|
||||
|
||||
case WSAENOTCONN:
|
||||
case WSAECONNABORTED:
|
||||
errno = WSAENOTCONN;
|
||||
break;
|
||||
|
||||
case WSAEINTR:
|
||||
errno = EINTR;
|
||||
break;
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
if ((nread < 0) && (errno == EAGAIN)) {
|
||||
return PACKET_EAGAIN;
|
||||
}
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user