aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/ProtoRPC
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-12-06 13:08:34 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-12-06 13:10:57 -0800
commiteeced98fc556c6a5bc3a5dedc171c98747217078 (patch)
tree4d9c1df2c6a46b10b8ea4d3ade38012bcaef41b6 /src/objective-c/ProtoRPC
parent76f1ec16e1880605215beb60a204b0cab7c36b2d (diff)
Rename handlers to didXxx
Diffstat (limited to 'src/objective-c/ProtoRPC')
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.h12
-rw-r--r--src/objective-c/ProtoRPC/ProtoRPC.m24
2 files changed, 18 insertions, 18 deletions
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h
index 1819fa9379..287aa0369b 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.h
+++ b/src/objective-c/ProtoRPC/ProtoRPC.h
@@ -33,12 +33,12 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Issued when initial metadata is received from the server.
*/
-- (void)receivedInitialMetadata:(nullable NSDictionary *)initialMetadata;
+- (void)didReceiveInitialMetadata:(nullable NSDictionary *)initialMetadata;
/**
* Issued when a message is received from the server. The message is the deserialized proto object.
*/
-- (void)receivedProtoMessage:(nullable GPBMessage *)message;
+- (void)didReceiveProtoMessage:(nullable GPBMessage *)message;
/**
* Issued when a call finished. If the call finished successfully, \a error is nil and \a
@@ -46,8 +46,8 @@ NS_ASSUME_NONNULL_BEGIN
* is non-nil and contains the corresponding error information, including gRPC error codes and
* error descriptions.
*/
-- (void)closedWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata
- error:(nullable NSError *)error;
+- (void)didCloseWithTrailingMetadata:(nullable NSDictionary *)trailingMetadata
+ error:(nullable NSError *)error;
@required
@@ -83,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Cancel the request of this call at best effort. It attempts to notify the server that the RPC
- * should be cancelled, and issue closedWithTrailingMetadata:error: callback with error code
+ * should be cancelled, and issue didCloseWithTrailingMetadata:error: callback with error code
* CANCELED if no other error code has already been issued.
*/
- (void)cancel;
@@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Cancel the request of this call at best effort. It attempts to notify the server that the RPC
- * should be cancelled, and issue closedWithTrailingMetadata:error: callback with error code
+ * should be cancelled, and issue didCloseWithTrailingMetadata:error: callback with error code
* CANCELED if no other error code has already been issued.
*/
- (void)cancel;
diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m
index 09f8d03af6..886e31ce58 100644
--- a/src/objective-c/ProtoRPC/ProtoRPC.m
+++ b/src/objective-c/ProtoRPC/ProtoRPC.m
@@ -144,14 +144,14 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
@synchronized(self) {
copiedCall = _call;
_call = nil;
- if ([_handler respondsToSelector:@selector(closedWithTrailingMetadata:error:)]) {
+ if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) {
dispatch_async(_handler.dispatchQueue, ^{
id<GRPCProtoResponseHandler> copiedHandler = nil;
@synchronized(self) {
copiedHandler = self->_handler;
self->_handler = nil;
}
- [copiedHandler closedWithTrailingMetadata:nil
+ [copiedHandler didCloseWithTrailingMetadata:nil
error:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeCancelled
userInfo:@{
@@ -187,7 +187,7 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
[call finish];
}
-- (void)receivedInitialMetadata:(NSDictionary *)initialMetadata {
+- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata {
@synchronized(self) {
if (initialMetadata != nil && [_handler respondsToSelector:@selector(initialMetadata:)]) {
dispatch_async(_dispatchQueue, ^{
@@ -195,35 +195,35 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
@synchronized(self) {
copiedHandler = self->_handler;
}
- [copiedHandler receivedInitialMetadata:initialMetadata];
+ [copiedHandler didReceiveInitialMetadata:initialMetadata];
});
}
}
}
-- (void)receivedRawMessage:(NSData *)message {
+- (void)didReceiveRawMessage:(NSData *)message {
if (message == nil) return;
NSError *error = nil;
GPBMessage *parsed = [_responseClass parseFromData:message error:&error];
@synchronized(self) {
- if (parsed && [_handler respondsToSelector:@selector(receivedProtoMessage:)]) {
+ if (parsed && [_handler respondsToSelector:@selector(didReceiveProtoMessage:)]) {
dispatch_async(_dispatchQueue, ^{
id<GRPCProtoResponseHandler> copiedHandler = nil;
@synchronized(self) {
copiedHandler = self->_handler;
}
- [copiedHandler receivedProtoMessage:parsed];
+ [copiedHandler didReceiveProtoMessage:parsed];
});
} else if (!parsed &&
- [_handler respondsToSelector:@selector(closedWithTrailingMetadata:error:)]) {
+ [_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) {
dispatch_async(_dispatchQueue, ^{
id<GRPCProtoResponseHandler> copiedHandler = nil;
@synchronized(self) {
copiedHandler = self->_handler;
self->_handler = nil;
}
- [copiedHandler closedWithTrailingMetadata:nil
+ [copiedHandler didCloseWithTrailingMetadata:nil
error:ErrorForBadProto(message, _responseClass, error)];
});
[_call cancel];
@@ -232,16 +232,16 @@ static NSError *ErrorForBadProto(id proto, Class expectedClass, NSError *parsing
}
}
-- (void)closedWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error {
+- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error {
@synchronized(self) {
- if ([_handler respondsToSelector:@selector(closedWithTrailingMetadata:error:)]) {
+ if ([_handler respondsToSelector:@selector(didCloseWithTrailingMetadata:error:)]) {
dispatch_async(_dispatchQueue, ^{
id<GRPCProtoResponseHandler> copiedHandler = nil;
@synchronized(self) {
copiedHandler = self->_handler;
self->_handler = nil;
}
- [copiedHandler closedWithTrailingMetadata:trailingMetadata error:error];
+ [copiedHandler didCloseWithTrailingMetadata:trailingMetadata error:error];
});
}
_call = nil;