|
|
|
@ -1198,10 +1198,30 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, |
|
|
|
|
|
|
|
|
|
static void maybe_start_some_streams(grpc_chttp2_transport* t) { |
|
|
|
|
grpc_chttp2_stream* s; |
|
|
|
|
/* cancel out streams that will never be started */ |
|
|
|
|
if (t->goaway_error != GRPC_ERROR_NONE) { |
|
|
|
|
while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { |
|
|
|
|
grpc_chttp2_cancel_stream( |
|
|
|
|
t, s, |
|
|
|
|
grpc_error_set_int( |
|
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"), |
|
|
|
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) { |
|
|
|
|
while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { |
|
|
|
|
grpc_chttp2_cancel_stream( |
|
|
|
|
t, s, |
|
|
|
|
grpc_error_set_int( |
|
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), |
|
|
|
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
/* start streams where we have free grpc_chttp2_stream ids and free
|
|
|
|
|
* concurrency */ |
|
|
|
|
while (t->next_stream_id <= MAX_CLIENT_STREAM_ID && |
|
|
|
|
grpc_chttp2_stream_map_size(&t->stream_map) < |
|
|
|
|
while (grpc_chttp2_stream_map_size(&t->stream_map) < |
|
|
|
|
t->settings[GRPC_PEER_SETTINGS] |
|
|
|
|
[GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS] && |
|
|
|
|
grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { |
|
|
|
@ -1225,15 +1245,6 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) { |
|
|
|
|
grpc_chttp2_mark_stream_writable(t, s); |
|
|
|
|
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM); |
|
|
|
|
} |
|
|
|
|
/* cancel out streams that will never be started */ |
|
|
|
|
while (t->next_stream_id >= MAX_CLIENT_STREAM_ID && |
|
|
|
|
grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) { |
|
|
|
|
grpc_chttp2_cancel_stream( |
|
|
|
|
t, s, |
|
|
|
|
grpc_error_set_int( |
|
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"), |
|
|
|
|
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Flag that this closure barrier may be covering a write in a pollset, and so
|
|
|
|
|