Skip to content

Commit

Permalink
add AWS_ERROR_HTTP_MAX_CONCURRENT_STREAMS_EXCEEDED (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK authored Nov 2, 2021
1 parent 4825acf commit 236ce08
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/aws/http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enum aws_http_errors {
AWS_ERROR_HTTP_PROXY_STRATEGY_TOKEN_RETRIEVAL_FAILURE,
AWS_ERROR_HTTP_PROXY_CONNECT_FAILED_RETRYABLE,
AWS_ERROR_HTTP_PROTOCOL_SWITCH_FAILURE,
AWS_ERROR_HTTP_MAX_CONCURRENT_STREAMS_EXCEEDED,

AWS_ERROR_HTTP_END_RANGE = AWS_ERROR_ENUM_END_RANGE(AWS_C_HTTP_PACKAGE_ID)
};
Expand Down
6 changes: 6 additions & 0 deletions source/h2_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,7 @@ static void s_move_stream_to_thread(
uint32_t max_concurrent_streams = connection->thread_data.settings_peer[AWS_HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS];
if (aws_hash_table_get_entry_count(&connection->thread_data.active_streams_map) >= max_concurrent_streams) {
AWS_H2_STREAM_LOG(ERROR, stream, "Failed activating stream, max concurrent streams are reached");
aws_raise_error(AWS_ERROR_HTTP_MAX_CONCURRENT_STREAMS_EXCEEDED);
goto error;
}

Expand Down Expand Up @@ -2217,6 +2218,11 @@ static void s_connection_update_window(struct aws_http_connection *connection_ba
aws_h2_frame_destroy(connection_window_update_frame);
return;
}
CONNECTION_LOGF(
TRACE,
connection,
"User requested to update the HTTP/2 connection's flow-control windows by %" PRIu32 ".",
increment_size);
return;
overflow:
/* Shutdown the connection as overflow detected */
Expand Down
6 changes: 6 additions & 0 deletions source/h2_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ static int s_stream_reset_stream(struct aws_http_stream *stream_base, uint32_t h
.h2_code = http2_error,
};

AWS_LOGF_TRACE(
AWS_LS_HTTP_STREAM,
"id=%p: User requested RST_STREAM with error code %s (0x%x)",
(void *)stream_base,
aws_http2_error_code_to_str(http2_error),
http2_error);
return s_stream_reset_stream_internal(stream_base, stream_error);
}

Expand Down
2 changes: 2 additions & 0 deletions source/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ const char *aws_http_status_text(int status_code) {
return "Not Extended";
case AWS_HTTP_STATUS_CODE_511_NETWORK_AUTHENTICATION_REQUIRED:
return "Network Authentication Required";
case AWS_ERROR_HTTP_MAX_CONCURRENT_STREAMS_EXCEEDED:
return "Max concurrent stream reached";
default:
return "";
}
Expand Down

0 comments on commit 236ce08

Please sign in to comment.