aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nnoble@google.com>2017-10-10 09:47:50 -0700
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2017-10-10 19:58:10 +0200
commit850568944ae0e5959f939aa539ce6ad8c07c99c9 (patch)
treeaf20a71b79d83d2050f34f54202c5cb8540e3d1a /src/core
parentb6142ef1a6dc70565f468346c7935f43dbcb55fa (diff)
Fixing init-test timeout.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lib/iomgr/iocp_windows.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc
index 336cc86c75..7da60c2c14 100644
--- a/src/core/lib/iomgr/iocp_windows.cc
+++ b/src/core/lib/iomgr/iocp_windows.cc
@@ -21,6 +21,7 @@
#ifdef GRPC_WINSOCK_SOCKET
#include <winsock2.h>
+#include <limits>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -43,11 +44,14 @@ static HANDLE g_iocp;
static DWORD deadline_to_millis_timeout(grpc_exec_ctx *exec_ctx,
grpc_millis deadline) {
- gpr_timespec timeout;
if (deadline == GRPC_MILLIS_INF_FUTURE) {
return INFINITE;
}
- return (DWORD)GPR_MAX(0, deadline - grpc_exec_ctx_now(exec_ctx));
+ grpc_millis now = grpc_exec_ctx_now(exec_ctx);
+ if (deadline < now) return 0;
+ grpc_millis timeout = deadline - now;
+ if (timeout > std::numeric_limits<DWORD>::max()) return INFINITE;
+ return static_cast<DWORD>(deadline - now);
}
grpc_iocp_work_status grpc_iocp_work(grpc_exec_ctx *exec_ctx,