File tree 2 files changed +14
-1
lines changed
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
127
127
AWS_HTTP_API
128
128
int aws_http_client_connect (const struct aws_http_client_connection_options * options );
129
129
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
+
130
137
/**
131
138
* Users must release the connection when they are done with it.
132
139
* 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(
166
166
return NULL ;
167
167
}
168
168
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
+ }
170
176
171
177
void aws_http_connection_release (struct aws_http_connection * connection ) {
172
178
assert (connection );
You can’t perform that action at this time.
0 commit comments