Add comment for timeout; assert on negative timeout value; fix timeout test

pull/12339/head
Muxi Yan 7 years ago
parent afa4700501
commit f6e61bf768
  1. 4
      src/objective-c/GRPCClient/GRPCCall.h
  2. 4
      src/objective-c/GRPCClient/private/GRPCChannel.m
  3. 2
      src/objective-c/tests/GRPCClientTests.m

@ -170,7 +170,9 @@ extern id const kGRPCTrailersKey;
@property (atomic, copy, readwrite) NSString *serverName;
/**
* The timeout for the RPC call in milliseconds. If set to 0, the call will not timeout.
* The timeout for the RPC call in milliseconds. If set to 0, the call will not timeout. If set to
* positive, the gRPC call returns with status GRPCErrorCodeDeadlineExceeded. A negative value is
* not allowed.
*/
@property NSTimeInterval timeout;

@ -184,6 +184,10 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) {
serverName:(NSString *)serverName
timeout:(NSTimeInterval)timeout
completionQueue:(GRPCCompletionQueue *)queue {
GPR_ASSERT(timeout >= 0);
if (timeout < 0) {
timeout = 0;
}
grpc_slice host_slice;
if (serverName) {
host_slice = grpc_slice_from_copied_string(serverName.UTF8String);

@ -437,7 +437,7 @@ static GRPCProtoMethod *kUnaryCallMethod;
[completion fulfill];
}];
call.timeout = 1;
call.timeout = 0.001;
[call startWithWriteable:responsesWriteable];
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];

Loading…
Cancel
Save