aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/fling
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-01-27 10:27:44 -0800
committerGravatar GitHub <noreply@github.com>2017-01-27 10:27:44 -0800
commit46357c882df1afc28f7a5228c40fde522093fa32 (patch)
tree13e6432254208fc3fca4a0bbbdced519f9b0eab3 /test/core/fling
parent8daca99390a56ad1c8aba74cefcc85a5ac1aa78a (diff)
parenta78da60a8ac8f8777aedc02e463f35c4e0cac906 (diff)
Merge pull request #9444 from ctiller/rollfwd
Re-integrate metadata handling changes
Diffstat (limited to 'test/core/fling')
-rw-r--r--test/core/fling/client.c20
-rw-r--r--test/core/fling/server.c8
2 files changed, 15 insertions, 13 deletions
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index e1a4630094..c4de949b3a 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -57,8 +57,7 @@ static grpc_metadata_array initial_metadata_recv;
static grpc_metadata_array trailing_metadata_recv;
static grpc_byte_buffer *response_payload_recv = NULL;
static grpc_status_code status;
-static char *details = NULL;
-static size_t details_capacity = 0;
+static grpc_slice details;
static grpc_op *op;
static void init_ping_pong_request(void) {
@@ -86,15 +85,16 @@ static void init_ping_pong_request(void) {
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
- op->data.recv_status_on_client.status_details_capacity = &details_capacity;
op++;
}
static void step_ping_pong_request(void) {
GPR_TIMER_BEGIN("ping_pong", 1);
- call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
- "/Reflector/reflectUnary", "localhost",
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ grpc_slice host = grpc_slice_from_static_string("localhost");
+ call = grpc_channel_create_call(
+ channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
+ grpc_slice_from_static_string("/Reflector/reflectUnary"), &host,
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops,
(size_t)(op - ops),
(void *)1, NULL));
@@ -109,9 +109,11 @@ static void init_ping_pong_stream(void) {
grpc_metadata_array_init(&initial_metadata_recv);
grpc_call_error error;
- call = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
- "/Reflector/reflectStream", "localhost",
- gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ grpc_slice host = grpc_slice_from_static_string("localhost");
+ call = grpc_channel_create_call(
+ channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
+ grpc_slice_from_static_string("/Reflector/reflectStream"), &host,
+ gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
stream_init_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA;
stream_init_ops[0].data.send_initial_metadata.count = 0;
stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA;
diff --git a/test/core/fling/server.c b/test/core/fling/server.c
index 79e5e35211..11742cedb6 100644
--- a/test/core/fling/server.c
+++ b/test/core/fling/server.c
@@ -118,7 +118,7 @@ static void handle_unary_method(void) {
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.trailing_metadata_count = 0;
- op->data.send_status_from_server.status_details = "";
+ op->data.send_status_from_server.status_details = NULL;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
@@ -168,7 +168,7 @@ static void start_send_status(void) {
status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER;
status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK;
status_op[0].data.send_status_from_server.trailing_metadata_count = 0;
- status_op[0].data.send_status_from_server.status_details = "";
+ status_op[0].data.send_status_from_server.status_details = NULL;
status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
status_op[1].data.recv_close_on_server.cancelled = &was_cancelled;
@@ -259,8 +259,8 @@ int main(int argc, char **argv) {
switch ((intptr_t)s) {
case FLING_SERVER_NEW_REQUEST:
if (call != NULL) {
- if (0 ==
- strcmp(call_details.method, "/Reflector/reflectStream")) {
+ if (0 == grpc_slice_str_cmp(call_details.method,
+ "/Reflector/reflectStream")) {
/* Received streaming call. Send metadata here. */
start_read_op(FLING_SERVER_READ_FOR_STREAMING);
send_initial_metadata();