Non-handled tls packets in the message queue

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Non-handled tls packets in the message queue

Park, Sungjin-2
I encountered a problem in receiving tls packets in my application.

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.

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.

--- a/lib/ssl/src/tls_connection.erl
+++ b/lib/ssl/src/tls_connection.erl
@@ -602,12 +602,8 @@ next_record(#state{protocol_buffers =
 next_record(#state{protocol_buffers = #protocol_buffers{tls_packets = [], tls_cipher_texts = []},
                   socket = Socket,
                   transport_cb = Transport} = State) ->
-    case tls_socket:setopts(Transport, Socket, [{active,once}]) of
-       ok ->
-           {no_record, State};
-       _ ->
-           {socket_closed, State}
-    end;
+    tls_socket:setopts(Transport, Socket, [{active,once}]),
+    {no_record, State};
 next_record(State) ->
     {no_record, State}.

--
Park, Sungjin


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions