Просмотр исходного кода

Ranch leaks sockets when protocols fail to start

When a protocol fails to start, the socket will not be closed.
juhlig 6 лет назад
Родитель
Сommit
743808d548
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      src/ranch_conns_sup.erl

+ 1 - 0
src/ranch_conns_sup.erl

@@ -140,6 +140,7 @@ loop(State=#state{parent=Parent, ref=Ref, conn_type=ConnType,
 					"Ranch listener ~p connection process start failure; "
 					"~p:start_link/4 crashed with reason: ~p:~999999p~n",
 					[Ref, Protocol, Class, Reason], Logger),
+				Transport:close(Socket),
 				loop(State, CurConns, NbChildren, Sleepers)
 			end;
 		{?MODULE, active_connections, To, Tag} ->