grpc-c
grpc-c copied to clipboard
Timeout handling in grpc_c_read asserts
When using a timeout in grpc_c_read() (last argument), we hit an assert
in the gRPC core lib!
Reason being - use of GPR_CLOCK_MONOTONIC instead of GPR_TIMESPAN
The following fix is needed:
--- a/lib/src/stream_ops.c
+++ b/lib/src/stream_ops.c
@@ -16,7 +16,7 @@ gpr_timespec grpc_c_deadline_from_timeout(long timeout) {
deadline = gpr_time_0(GPR_CLOCK_MONOTONIC);
} else {
deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC),
- gpr_time_from_millis(timeout, GPR_CLOCK_MONOTONIC));
+ gpr_time_from_millis(timeout, GPR_TIMESPAN));
}