mirror of
https://github.com/vale981/ray
synced 2025-03-09 04:46:38 -04:00

* Switch hiredis on Windows to that of the Windows port of Redis * Use boost::asio::ip::tcp::socket::native_handle_type * Use normal hiredis instead of Windows-specific one * Finish up using normal hiredis Co-authored-by: Mehrdad <noreply@github.com>
30 lines
823 B
Diff
30 lines
823 B
Diff
diff --git deps/hiredis/net.c deps/hiredis/net.c
|
|
--- deps/hiredis/net.c
|
|
+++ deps/hiredis/net.c
|
|
@@ -204,11 +204,24 @@
|
|
static int redisContextWaitReady(redisContext *c, long msec) {
|
|
+#ifdef _WINSOCKAPI_
|
|
+ fd_set wset;
|
|
+
|
|
+ FD_ZERO(&wset);
|
|
+ FD_SET(_get_osfhandle(c->fd), &wset);
|
|
+#else
|
|
struct pollfd wfd[1];
|
|
|
|
wfd[0].fd = c->fd;
|
|
wfd[0].events = POLLOUT;
|
|
+#endif
|
|
|
|
if (errno == EINPROGRESS) {
|
|
int res;
|
|
|
|
+#ifdef _WINSOCKAPI_
|
|
+ struct timeval tv = { msec / 1000, (msec % 1000) * 1000 };
|
|
+ res = select(_get_osfhandle(c->fd) + 1, NULL, &wset, NULL, msec >= 0 ? &tv : NULL);
|
|
+#else
|
|
+ res = poll(wfd, 1, msec);
|
|
+#endif
|
|
- if ((res = poll(wfd, 1, msec)) == -1) {
|
|
+ if (res == -1) {
|
|
__redisSetErrorFromErrno(c, REDIS_ERR_IO, "poll(2)");
|
|
--
|