Skip to content

Commit 4b20af8

Browse files
committed
ssl: Fix windows IOCP socket path
When events (renegotiate, alert, post_handshake_data) arrive during an async send, they are postponed and low is set to 0 as a signal to keep the sender in async_wait until the buffer fully drains. In do_async_send/6, the {completion, _} branch called new_async/1 which overwrote low with the default (4096), losing the signal. This caused unnecessary state ping-pong between async_wait and connection on Windows (IOCP) when postponed events were pending. Preserve low from the original async record and guard the transition to connection on low > 0.
1 parent 9503f84 commit 4b20af8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/ssl/src/tls_sender.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,11 @@ do_async_send(Transport, Socket, Handle, Nextstate, Result,
670670
{keep_state_and_data, []};
671671
{completion, _} ->
672672
BuffSz = iolist_size(MsgQ),
673+
#async{low = OldLow} = Async0,
673674
#async{high = High} = Async1 = new_async(StateData),
674675
Sent = sent_data(completion, BuffSz),
675-
Async = Async1#async{q_rev = [MsgQ], size = BuffSz, sent = Sent},
676-
case BuffSz < High of
676+
Async = Async1#async{q_rev = [MsgQ], size = BuffSz, sent = Sent, low = OldLow},
677+
case OldLow > 0 andalso BuffSz < High of
677678
true ->
678679
send_reply(From, ok),
679680
{next_state, Nextstate, StateData#data{buff = Async}};

0 commit comments

Comments
 (0)