aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCWrappedCall.m')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index 43c564552b..38fcae0299 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -194,7 +194,7 @@
@implementation GRPCOpRecvStatus{
grpc_status_code _statusCode;
- grpc_slice _details;
+ char *_details;
size_t _detailsCapacity;
grpc_metadata_array _trailers;
}
@@ -208,6 +208,7 @@
_op.op = GRPC_OP_RECV_STATUS_ON_CLIENT;
_op.data.recv_status_on_client.status = &_statusCode;
_op.data.recv_status_on_client.status_details = &_details;
+ _op.data.recv_status_on_client.status_details_capacity = &_detailsCapacity;
grpc_metadata_array_init(&_trailers);
_op.data.recv_status_on_client.trailing_metadata = &_trailers;
if (handler) {
@@ -215,15 +216,11 @@
__weak typeof(self) weakSelf = self;
_handler = ^{
__strong typeof(self) strongSelf = weakSelf;
- if (strongSelf) {
- char *details = grpc_slice_to_c_string(strongSelf->_details);
- NSError *error = [NSError grpc_errorFromStatusCode:strongSelf->_statusCode
- details:details];
- NSDictionary *trailers = [NSDictionary
- grpc_dictionaryFromMetadataArray:strongSelf->_trailers];
- handler(error, trailers);
- gpr_free(details);
- }
+ NSError *error = [NSError grpc_errorFromStatusCode:strongSelf->_statusCode
+ details:strongSelf->_details];
+ NSDictionary *trailers = [NSDictionary
+ grpc_dictionaryFromMetadataArray:strongSelf->_trailers];
+ handler(error, trailers);
};
}
}
@@ -232,7 +229,7 @@
- (void)dealloc {
grpc_metadata_array_destroy(&_trailers);
- grpc_slice_unref(_details);
+ gpr_free(_details);
}
@end