aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-01-19 20:31:44 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-01-21 13:52:52 -0800
commit12b533de59e1c1ec81e52a9f51df70b8dfbe77a7 (patch)
treeba06069d3a9d8d0d14834eece67485e502c98ed0 /src/core
parentd2d0a1184e15c6497b11c4248b335573dd87d459 (diff)
Make send/recv_metadata take ownership of passed in metadata
Diffstat (limited to 'src/core')
-rw-r--r--src/core/channel/channel_stack.c4
-rw-r--r--src/core/channel/http_client_filter.c12
-rw-r--r--src/core/channel/http_server_filter.c4
-rw-r--r--src/core/security/auth.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c
index 1320568d23..c70b565d2b 100644
--- a/src/core/channel/channel_stack.c
+++ b/src/core/channel/channel_stack.c
@@ -209,7 +209,7 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem,
metadata_op.dir = GRPC_CALL_UP;
metadata_op.done_cb = do_nothing;
metadata_op.user_data = NULL;
- metadata_op.data.metadata = grpc_mdelem_ref(mdelem);
+ metadata_op.data.metadata = mdelem;
grpc_call_next_op(cur_elem, &metadata_op);
}
@@ -220,7 +220,7 @@ void grpc_call_element_send_metadata(grpc_call_element *cur_elem,
metadata_op.dir = GRPC_CALL_DOWN;
metadata_op.done_cb = do_nothing;
metadata_op.user_data = NULL;
- metadata_op.data.metadata = grpc_mdelem_ref(mdelem);
+ metadata_op.data.metadata = mdelem;
grpc_call_next_op(cur_elem, &metadata_op);
}
diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c
index b139b72795..1f6f3e0ca3 100644
--- a/src/core/channel/http_client_filter.c
+++ b/src/core/channel/http_client_filter.c
@@ -67,8 +67,8 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem,
/* Send : prefixed headers, which have to be before any application
* layer headers. */
calld->sent_headers = 1;
- grpc_call_element_send_metadata(elem, channeld->method);
- grpc_call_element_send_metadata(elem, channeld->scheme);
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->method));
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->scheme));
}
grpc_call_next_op(elem, op);
break;
@@ -76,12 +76,12 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem,
if (!calld->sent_headers) {
/* Send : prefixed headers, if we haven't already */
calld->sent_headers = 1;
- grpc_call_element_send_metadata(elem, channeld->method);
- grpc_call_element_send_metadata(elem, channeld->scheme);
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->method));
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->scheme));
}
/* Send non : prefixed headers */
- grpc_call_element_send_metadata(elem, channeld->te_trailers);
- grpc_call_element_send_metadata(elem, channeld->content_type);
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->te_trailers));
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->content_type));
grpc_call_next_op(elem, op);
break;
default:
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 8290ead8a7..87f9f437e6 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -127,7 +127,7 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem,
gpr_log(GPR_ERROR, "Received :path twice");
grpc_mdelem_unref(calld->path);
}
- calld->path = grpc_mdelem_ref(op->data.metadata);
+ calld->path = op->data.metadata;
op->done_cb(op->user_data, GRPC_OP_OK);
} else {
/* pass the event up */
@@ -163,7 +163,7 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem,
if (!calld->sent_status) {
calld->sent_status = 1;
/* status is reffed by grpc_call_element_send_metadata */
- grpc_call_element_send_metadata(elem, channeld->status);
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(channeld->status));
}
grpc_call_next_op(elem, op);
break;
diff --git a/src/core/security/auth.c b/src/core/security/auth.c
index f743b25838..9d0c075bc3 100644
--- a/src/core/security/auth.c
+++ b/src/core/security/auth.c
@@ -57,7 +57,7 @@ static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems,
grpc_call_element *elem = (grpc_call_element *)user_data;
size_t i;
for (i = 0; i < num_md; i++) {
- grpc_call_element_send_metadata(elem, md_elems[i]);
+ grpc_call_element_send_metadata(elem, grpc_mdelem_ref(md_elems[i]));
}
grpc_call_next_op(elem, &((call_data *)elem->call_data)->op);
}