File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,13 @@ AWS_EXTERN_C_BEGIN
127127AWS_HTTP_API
128128int aws_http_client_connect (const struct aws_http_client_connection_options * options );
129129
130+ /**
131+ * Begin shutdown sequence of the connection if it hasn't already started. It's safe to call this
132+ * function regardless of the connection state as long as you hold a reference to the connection.
133+ */
134+ AWS_HTTP_API
135+ int aws_http_client_connection_close (struct aws_http_connection * connection );
136+
130137/**
131138 * Users must release the connection when they are done with it.
132139 * The connection's memory cannot be reclaimed until this is done.
Original file line number Diff line number Diff line change @@ -166,7 +166,13 @@ static struct aws_http_connection *s_connection_new(
166166 return NULL ;
167167}
168168
169- /* TODO: probably should have a aws_http_connection_close(int error_code) function */
169+ int aws_http_client_connection_close (struct aws_http_connection * connection ) {
170+ if (connection -> channel_slot -> channel ) {
171+ return aws_channel_shutdown (connection -> channel_slot -> channel , AWS_ERROR_SUCCESS );
172+ }
173+
174+ return AWS_OP_SUCCESS ;
175+ }
170176
171177void aws_http_connection_release (struct aws_http_connection * connection ) {
172178 assert (connection );
You can’t perform that action at this time.
0 commit comments