Changeset View
Changeset View
Standalone View
Standalone View
src/netbase.cpp
Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | while (len > 0 && curTime < endTime) { | ||||
nErr == WSAEINVAL) { | nErr == WSAEINVAL) { | ||||
if (!IsSelectableSocket(hSocket)) { | if (!IsSelectableSocket(hSocket)) { | ||||
return IntrRecvError::NetworkError; | return IntrRecvError::NetworkError; | ||||
} | } | ||||
int timeout_ms = std::min(endTime - curTime, maxWait); | int timeout_ms = std::min(endTime - curTime, maxWait); | ||||
#ifdef USE_POLL | #ifdef USE_POLL | ||||
struct pollfd pollfd = {}; | struct pollfd pollfd = {}; | ||||
pollfd.fd = hSocket; | pollfd.fd = hSocket; | ||||
pollfd.events = POLLIN | POLLOUT; | pollfd.events = POLLIN; | ||||
int nRet = poll(&pollfd, 1, timeout_ms); | int nRet = poll(&pollfd, 1, timeout_ms); | ||||
#else | #else | ||||
struct timeval tval = MillisToTimeval(timeout_ms); | struct timeval tval = MillisToTimeval(timeout_ms); | ||||
fd_set fdset; | fd_set fdset; | ||||
FD_ZERO(&fdset); | FD_ZERO(&fdset); | ||||
FD_SET(hSocket, &fdset); | FD_SET(hSocket, &fdset); | ||||
int nRet = select(hSocket + 1, &fdset, nullptr, nullptr, &tval); | int nRet = select(hSocket + 1, &fdset, nullptr, nullptr, &tval); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 520 Lines • Show Last 20 Lines |