diff options
author | Nicolas Noble <nicolasnoble@users.noreply.github.com> | 2017-10-10 16:28:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-10 16:28:45 -0700 |
commit | b9fbb305d966cf3fc036555e492451607412df12 (patch) | |
tree | eebf140a35d30e5cd3033bb41e4b43d88dc500ed /src | |
parent | e9b1643651f54fbe7b72c7255f7bae9b08dc7d82 (diff) | |
parent | 850568944ae0e5959f939aa539ce6ad8c07c99c9 (diff) |
Merge pull request #12929 from nicolasnoble/init-test-timeout
Fixing init-test timeout.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/iomgr/iocp_windows.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index e54584c8fd..78185cc084 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> @@ -46,7 +47,11 @@ static DWORD deadline_to_millis_timeout(grpc_exec_ctx *exec_ctx, 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, |