Skip to content

Commit

Permalink
unless we finished negotiation
Browse files Browse the repository at this point in the history
  • Loading branch information
TingDaoK committed Jul 10, 2024
1 parent ca84785 commit cd0a9ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion source/darwin/secure_transport_tls_channel_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ static int s_handle_shutdown(
* In case of socket closed, we should check if we have any queued data in the handler,
* and make sure we pass those data down the pipeline before we complete the shutdown.
*/
if (!aws_linked_list_empty(&secure_transport_handler->input_queue)) {
if (secure_transport_handler->negotiation_finished &&
!aws_linked_list_empty(&secure_transport_handler->input_queue)) {
if (secure_transport_handler->read_delayed_shutdown_task == NULL) {
secure_transport_handler->read_delayed_shutdown_task =
aws_mem_calloc(handler->alloc, 1, sizeof(struct aws_tls_delayed_shutdown_task));
Expand Down
2 changes: 1 addition & 1 deletion source/s2n/s2n_tls_channel_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ static int s_s2n_handler_shutdown(
* In case of socket closed, we should check if we have any queued data in the handler,
* and make sure we pass those data down the pipeline before we complete the shutdown.
*/
if (!aws_linked_list_empty(&s2n_handler->input_queue)) {
if (s2n_handler->state == NEGOTIATION_SUCCEEDED && !aws_linked_list_empty(&s2n_handler->input_queue)) {
if (s2n_handler->read_delayed_shutdown_task == NULL) {
s2n_handler->read_delayed_shutdown_task =
aws_mem_calloc(handler->alloc, 1, sizeof(struct aws_tls_delayed_shutdown_task));
Expand Down
2 changes: 1 addition & 1 deletion source/windows/secure_channel_tls_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ static int s_handler_shutdown(
}
}
} else {
if (!abort_immediately && sc_handler->buffered_read_out_data_buf.len) {
if (!abort_immediately && sc_handler->negotiation_finished && sc_handler->buffered_read_out_data_buf.len) {
/* We still have data pending to be delivered to the downstream. */
if (sc_handler->read_delayed_shutdown_task == NULL) {
sc_handler->read_delayed_shutdown_task =
Expand Down

0 comments on commit cd0a9ab

Please sign in to comment.