diff --git a/source/darwin/secure_transport_tls_channel_handler.c b/source/darwin/secure_transport_tls_channel_handler.c index f9e6b7d9d..b15aa3aad 100644 --- a/source/darwin/secure_transport_tls_channel_handler.c +++ b/source/darwin/secure_transport_tls_channel_handler.c @@ -516,7 +516,7 @@ static int s_handle_shutdown( struct secure_transport_handler *secure_transport_handler = handler->impl; if (dir == AWS_CHANNEL_DIR_WRITE) { - if (!error_code) { + if (!abort_immediately && error_code != AWS_IO_SOCKET_CLOSED) { AWS_LOGF_TRACE(AWS_LS_IO_TLS, "id=%p: shutting down write direction.", (void *)handler); SSLClose(secure_transport_handler->ctx); } diff --git a/source/s2n/s2n_tls_channel_handler.c b/source/s2n/s2n_tls_channel_handler.c index 043f6d620..c5f7c72b1 100644 --- a/source/s2n/s2n_tls_channel_handler.c +++ b/source/s2n/s2n_tls_channel_handler.c @@ -560,7 +560,7 @@ static int s_s2n_handler_shutdown( struct s2n_handler *s2n_handler = (struct s2n_handler *)handler->impl; if (dir == AWS_CHANNEL_DIR_WRITE) { - if (!error_code) { + if (!abort_immediately && error_code != AWS_IO_SOCKET_CLOSED) { AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Shutting down write direction", (void *)handler) s2n_blocked_status blocked; /* make a best effort, but the channel is going away after this run, so.... you only get one shot anyways */ diff --git a/source/windows/secure_channel_tls_handler.c b/source/windows/secure_channel_tls_handler.c index dad401b67..120594c73 100644 --- a/source/windows/secure_channel_tls_handler.c +++ b/source/windows/secure_channel_tls_handler.c @@ -1389,7 +1389,7 @@ static int s_handler_shutdown( struct secure_channel_handler *sc_handler = handler->impl; if (dir == AWS_CHANNEL_DIR_WRITE) { - if (!error_code) { + if (!abort_immediately && error_code != AWS_IO_SOCKET_CLOSED) { AWS_LOGF_DEBUG(AWS_LS_IO_TLS, "id=%p: Shutting down the write direction", (void *)handler) /* send a TLS alert. */ @@ -1413,7 +1413,8 @@ static int s_handler_shutdown( if (status != SEC_E_OK) { aws_raise_error(AWS_IO_SYS_CALL_FAILURE); - return aws_channel_slot_on_handler_shutdown_complete(slot, dir, AWS_IO_SYS_CALL_FAILURE, true); + return aws_channel_slot_on_handler_shutdown_complete( + slot, dir, AWS_IO_SYS_CALL_FAILURE, abort_immediately); } SecBuffer output_buffer = {