<div dir="ltr">I encountered a problem in receiving tls packets in my application.<div><br><div>After some investigation, I figured out that the process has a tls packet in it's message queue but didn't have a chance to handle it. This happens in a specific situation when the server closes the connection after sending large data which is split into several packets so that some of them remain in the message queue when the socket closes by FIN.</div><div><br></div><div>I followed OTP code and applied a patch below and confirmed it solved the problem. But I'm not quite sure if this is the right way to solve the problem nor why it was written that way in the first place -- dtls_connection seems to be working just as my patch.</div><div><br></div><div><div>--- a/lib/ssl/src/tls_connection.<wbr>erl</div><div>+++ b/lib/ssl/src/tls_connection.<wbr>erl</div><div>@@ -602,12 +602,8 @@ next_record(#state{protocol_<wbr>buffers =</div><div> next_record(#state{protocol_<wbr>buffers = #protocol_buffers{tls_packets = [], tls_cipher_texts = []},</div><div> socket = Socket,</div><div> transport_cb = Transport} = State) -></div><div>- case tls_socket:setopts(Transport, Socket, [{active,once}]) of</div><div>- ok -></div><div>- {no_record, State};</div><div>- _ -></div><div>- {socket_closed, State}</div><div>- end;</div><div>+ tls_socket:setopts(Transport, Socket, [{active,once}]),</div><div>+ {no_record, State};</div><div> next_record(State) -></div><div> {no_record, State}.</div><div><br></div>-- <br><div class="m_3500378034216111644gmail-m_-5430793829445965690gmail_signature">Park, Sungjin<div><br></div></div>
</div></div></div>