Rename deadline to timeout

pull/12339/head
Muxi Yan 8 years ago
parent f282c8f525
commit c7c8e3cb17
  1. 4
      src/objective-c/GRPCClient/GRPCCall.h
  2. 2
      src/objective-c/GRPCClient/GRPCCall.m
  3. 2
      src/objective-c/GRPCClient/private/GRPCChannel.h
  4. 12
      src/objective-c/GRPCClient/private/GRPCChannel.m
  5. 2
      src/objective-c/GRPCClient/private/GRPCHost.h
  6. 4
      src/objective-c/GRPCClient/private/GRPCHost.m
  7. 2
      src/objective-c/GRPCClient/private/GRPCWrappedCall.h
  8. 6
      src/objective-c/GRPCClient/private/GRPCWrappedCall.m
  9. 4
      src/objective-c/tests/GRPCClientTests.m

@ -170,9 +170,9 @@ extern id const kGRPCTrailersKey;
@property (atomic, copy, readwrite) NSString *serverName;
/**
* The deadline for the RPC call in milliseconds. If set to 0, the deadline will be infinity.
* The timeout for the RPC call in milliseconds. If set to 0, the call will not timeout.
*/
@property UInt64 deadline;
@property UInt64 timeout;
/**
* The container of the request headers of an RPC conforms to this protocol, which is a subset of

@ -424,7 +424,7 @@ static NSString * const kBearerPrefix = @"Bearer ";
_wrappedCall = [[GRPCWrappedCall alloc] initWithHost:_host
serverName:_serverName
path:_path
deadline:_deadline];
timeout:_timeout];
NSAssert(_wrappedCall, @"Error allocating RPC objects. Low memory?");
[self sendHeaders:_requestHeaders];

@ -63,6 +63,6 @@ struct grpc_channel_credentials;
- (nullable grpc_call *)unmanagedCallWithPath:(nonnull NSString *)path
serverName:(nonnull NSString *)serverName
deadline:(UInt64)deadline
timeout:(UInt64)timeout
completionQueue:(nonnull GRPCCompletionQueue *)queue;
@end

@ -182,18 +182,18 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) {
- (grpc_call *)unmanagedCallWithPath:(NSString *)path
serverName:(NSString *)serverName
deadline:(UInt64)deadline
timeout:(UInt64)timeout
completionQueue:(GRPCCompletionQueue *)queue {
grpc_slice host_slice;
if (serverName) {
host_slice = grpc_slice_from_copied_string(serverName.UTF8String);
}
grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String);
gpr_timespec deadline_ms = deadline == 0 ?
gpr_inf_future(GPR_CLOCK_REALTIME) :
gpr_time_add(
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis(deadline, GPR_TIMESPAN));
gpr_timespec deadline_ms = timeout == 0 ?
gpr_inf_future(GPR_CLOCK_REALTIME) :
gpr_time_add(
gpr_now(GPR_CLOCK_MONOTONIC),
gpr_time_from_millis(timeout, GPR_TIMESPAN));
grpc_call *call = grpc_channel_create_call(_unmanagedChannel,
NULL, GRPC_PROPAGATE_DEFAULTS,
queue.unmanagedQueue,

@ -55,7 +55,7 @@ struct grpc_channel_credentials;
/** Create a grpc_call object to the provided path on this host. */
- (nullable struct grpc_call *)unmanagedCallWithPath:(NSString *)path
serverName:(NSString *)serverName
deadline:(UInt64)deadline
timeout:(UInt64)timeout
completionQueue:(GRPCCompletionQueue *)queue;
// TODO: There's a race when a new RPC is coming through just as an existing one is getting

@ -121,7 +121,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
serverName:(NSString *)serverName
deadline:(UInt64)deadline
timeout:(UInt64)timeout
completionQueue:(GRPCCompletionQueue *)queue {
GRPCChannel *channel;
// This is racing -[GRPCHost disconnect].
@ -133,7 +133,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
}
return [channel unmanagedCallWithPath:path
serverName:serverName
deadline:deadline
timeout:timeout
completionQueue:queue];
}

@ -77,7 +77,7 @@
- (instancetype)initWithHost:(NSString *)host
serverName:(NSString *)serverName
path:(NSString *)path
deadline:(UInt64)deadline NS_DESIGNATED_INITIALIZER;
timeout:(UInt64)timeout NS_DESIGNATED_INITIALIZER;
- (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler;

@ -238,13 +238,13 @@
}
- (instancetype)init {
return [self initWithHost:nil serverName:nil path:nil deadline:0];
return [self initWithHost:nil serverName:nil path:nil timeout:0];
}
- (instancetype)initWithHost:(NSString *)host
serverName:(NSString *)serverName
path:(NSString *)path
deadline:(UInt64)deadline {
timeout:(UInt64)timeout {
if (!path || !host) {
[NSException raise:NSInvalidArgumentException
format:@"path and host cannot be nil."];
@ -258,7 +258,7 @@
_call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path
serverName:serverName
deadline:deadline
timeout:timeout
completionQueue:_queue];
if (_call == NULL) {
return nil;

@ -422,7 +422,7 @@ static GRPCProtoMethod *kUnaryCallMethod;
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];
}
- (void)testDeadline {
- (void)testTimeout {
__weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."];
GRPCCall *call = [[GRPCCall alloc] initWithHost:kHostAddress
@ -437,7 +437,7 @@ static GRPCProtoMethod *kUnaryCallMethod;
[completion fulfill];
}];
call.deadline = 1;
call.timeout = 1;
[call startWithWriteable:responsesWriteable];
[self waitForExpectationsWithTimeout:TEST_TIMEOUT handler:nil];

Loading…
Cancel
Save