Windows support (no TLS yet)

This commit is contained in:
Benjamin Sergeant
2018-10-08 21:42:45 -07:00
parent af12089e7a
commit 71b40c6d6c
5 changed files with 116 additions and 45 deletions

View File

@ -19,9 +19,9 @@
# endif
#endif
#include <unistd.h>
#include <errno.h>
// #include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <cstdlib>
#include <vector>
@ -273,12 +273,12 @@ namespace ix {
{
int N = (int) _rxbuf.size();
ssize_t ret;
int ret;
_rxbuf.resize(N + 1500);
ret = _socket->recv((char*)&_rxbuf[0] + N, 1500);
if (ret < 0 && (errno == EWOULDBLOCK ||
errno == EAGAIN)) {
if (ret < 0 && (_socket->getErrno() == EWOULDBLOCK ||
_socket->getErrno() == EAGAIN)) {
_rxbuf.resize(N);
break;
}
@ -575,8 +575,8 @@ namespace ix {
{
int ret = _socket->send((char*)&_txbuf[0], _txbuf.size());
if (ret < 0 && (errno == EWOULDBLOCK ||
errno == EAGAIN))
if (ret < 0 && (_socket->getErrno() == EWOULDBLOCK ||
_socket->getErrno() == EAGAIN))
{
break;
}