FS-5887 --resolve

This commit is contained in:
Anthony Minessale 2013-10-19 00:00:28 +05:00
parent bf78270540
commit 0d19abfbdb
3 changed files with 29 additions and 4 deletions

View File

@ -1 +1 @@
Tue Oct 8 12:10:32 CDT 2013
Fri Oct 18 23:59:59 CDT 2013

View File

@ -334,8 +334,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
#else
if (x++) Sleep(10);
#endif
} while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK ||
errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100);
} while (r == -1 && xp_is_blocking(xp_errno()) && x < 100);
if (x >= 100) {
r = -1;
@ -364,7 +363,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
do {
r = send(wsh->sock, data, bytes, 0);
} while (r == -1 && (errno == EAGAIN || errno == EINTR));
} while (r == -1 && xp_is_blocking(xp_errno()));
//if (r<0) {
//printf("wRITE FAIL: %s\n", strerror(errno));
@ -789,4 +788,28 @@ ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes)
return bytes;
}
#ifdef _MSC_VER
int xp_errno(void)
{
return WSAGetLastError();
}
int xp_is_blocking(int errcode)
{
return errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS;
}
#else
int xp_errno(void)
{
return errno;
}
int xp_is_blocking(int errcode)
{
return errcode == EAGAIN || errcode == EWOULDBLOCK || errcode == EINPROGRESS || errcode == EINTR;
}
#endif

View File

@ -91,6 +91,8 @@ void ws_destroy(wsh_t *wsh);
void init_ssl(void);
void deinit_ssl(void);
int xp_errno(void);
int xp_is_blocking(int errcode);
#ifndef _MSC_VER
static inline uint64_t get_unaligned_uint64(const void *p)