|
|
|
@ -154,7 +154,7 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
|
|
|
|
|
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, |
|
|
|
|
grpc_slice_from_static_string("/foo"), NULL, deadline, NULL); |
|
|
|
|
GPR_ASSERT(c); |
|
|
|
|
CHECK(c); |
|
|
|
|
|
|
|
|
|
grpc_metadata_array_init(&initial_metadata_recv); |
|
|
|
|
grpc_metadata_array_init(&trailing_metadata_recv); |
|
|
|
@ -162,7 +162,7 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
grpc_call_details_init(&call_details); |
|
|
|
|
|
|
|
|
|
int sl = socket(AF_INET, SOCK_STREAM, 0); |
|
|
|
|
GPR_ASSERT(sl >= 0); |
|
|
|
|
CHECK(sl >= 0); |
|
|
|
|
|
|
|
|
|
// Make an TCP endpoint to accept the connection |
|
|
|
|
struct sockaddr_in s_addr; |
|
|
|
@ -170,8 +170,8 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
s_addr.sin_family = AF_INET; |
|
|
|
|
s_addr.sin_addr.s_addr = htonl(INADDR_ANY); |
|
|
|
|
s_addr.sin_port = htons(port); |
|
|
|
|
GPR_ASSERT(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); |
|
|
|
|
GPR_ASSERT(0 == listen(sl, 5)); |
|
|
|
|
CHECK(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); |
|
|
|
|
CHECK(0 == listen(sl, 5)); |
|
|
|
|
|
|
|
|
|
memset(ops, 0, sizeof(ops)); |
|
|
|
|
op = ops; |
|
|
|
@ -208,11 +208,11 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
op->reserved = NULL; |
|
|
|
|
op++; |
|
|
|
|
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void *)1, NULL); |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == error); |
|
|
|
|
CHECK(GRPC_CALL_OK == error); |
|
|
|
|
|
|
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
|
|
|
|
int s = accept(sl, NULL, NULL); |
|
|
|
|
GPR_ASSERT(s >= 0); |
|
|
|
|
CHECK(s >= 0); |
|
|
|
|
|
|
|
|
|
// Close the connection after 1 second to trigger Cronet's on_failed() |
|
|
|
|
sleep(1); |
|
|
|
@ -223,7 +223,7 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
cqv.Expect((void *)1, true); |
|
|
|
|
cqv.Verify(); |
|
|
|
|
|
|
|
|
|
GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); |
|
|
|
|
CHECK(status == GRPC_STATUS_UNAVAILABLE); |
|
|
|
|
|
|
|
|
|
grpc_slice_unref(details); |
|
|
|
|
grpc_metadata_array_destroy(&initial_metadata_recv); |
|
|
|
@ -282,7 +282,7 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
|
|
|
|
|
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, |
|
|
|
|
grpc_slice_from_static_string("/foo"), NULL, deadline, NULL); |
|
|
|
|
GPR_ASSERT(c); |
|
|
|
|
CHECK(c); |
|
|
|
|
|
|
|
|
|
grpc_metadata_array_init(&initial_metadata_recv); |
|
|
|
|
grpc_metadata_array_init(&trailing_metadata_recv); |
|
|
|
@ -292,18 +292,18 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Coalescing"]; |
|
|
|
|
|
|
|
|
|
int sl = socket(AF_INET, SOCK_STREAM, 0); |
|
|
|
|
GPR_ASSERT(sl >= 0); |
|
|
|
|
CHECK(sl >= 0); |
|
|
|
|
struct sockaddr_in s_addr; |
|
|
|
|
memset(&s_addr, 0, sizeof(s_addr)); |
|
|
|
|
s_addr.sin_family = AF_INET; |
|
|
|
|
s_addr.sin_addr.s_addr = htonl(INADDR_ANY); |
|
|
|
|
s_addr.sin_port = htons(port); |
|
|
|
|
GPR_ASSERT(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); |
|
|
|
|
GPR_ASSERT(0 == listen(sl, 5)); |
|
|
|
|
CHECK(0 == bind(sl, (struct sockaddr *)&s_addr, sizeof(s_addr))); |
|
|
|
|
CHECK(0 == listen(sl, 5)); |
|
|
|
|
|
|
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ |
|
|
|
|
int s = accept(sl, NULL, NULL); |
|
|
|
|
GPR_ASSERT(s >= 0); |
|
|
|
|
CHECK(s >= 0); |
|
|
|
|
struct timeval tv; |
|
|
|
|
tv.tv_sec = 2; |
|
|
|
|
tv.tv_usec = 0; |
|
|
|
@ -391,7 +391,7 @@ unsigned int parse_h2_length(const char *field) { |
|
|
|
|
op->reserved = NULL; |
|
|
|
|
op++; |
|
|
|
|
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), (void *)1, NULL); |
|
|
|
|
GPR_ASSERT(GRPC_CALL_OK == error); |
|
|
|
|
CHECK(GRPC_CALL_OK == error); |
|
|
|
|
|
|
|
|
|
cqv.Expect((void *)1, true); |
|
|
|
|
cqv.Verify(); |
|
|
|
|