diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2017-11-28 16:46:41 +0100 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2017-11-30 07:42:52 +0100 |
commit | fb6d01a30cc4da420ea1be904ae3b9c9c1b6992e (patch) | |
tree | 2d94f13536e3bc1f3257786c6a3694577027a476 /src/csharp/ext | |
parent | e8b331305cd9613867e5c012a78030b89d9ef814 (diff) |
recycling of requestcallcontext
Diffstat (limited to 'src/csharp/ext')
-rw-r--r-- | src/csharp/ext/grpc_csharp_ext.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 24d779e1e5..6875d40aa0 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -226,17 +226,22 @@ grpcsharp_batch_context_destroy(grpcsharp_batch_context* ctx) { } GPR_EXPORT void GPR_CALLTYPE -grpcsharp_request_call_context_destroy(grpcsharp_request_call_context* ctx) { - if (!ctx) { - return; - } +grpcsharp_request_call_context_reset(grpcsharp_request_call_context* ctx) { /* NOTE: ctx->server_rpc_new.call is not destroyed because callback handler is supposed to take its ownership. */ grpc_call_details_destroy(&(ctx->call_details)); grpcsharp_metadata_array_destroy_metadata_only(&(ctx->request_metadata)); + memset(ctx, 0, sizeof(grpcsharp_request_call_context)); +} +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_request_call_context_destroy(grpcsharp_request_call_context* ctx) { + if (!ctx) { + return; + } + grpcsharp_request_call_context_reset(ctx); gpr_free(ctx); } |