diff options
Diffstat (limited to 'src/ranch_server.erl')
-rw-r--r-- | src/ranch_server.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ranch_server.erl b/src/ranch_server.erl index 078626f..a17e103 100644 --- a/src/ranch_server.erl +++ b/src/ranch_server.erl @@ -160,6 +160,11 @@ remove_process(Key = {listener, Ref}, MonitorRef, Pid, Monitors) -> true = ets:delete(?TAB, {connections, Pid}), lists:keydelete({MonitorRef, Pid}, 1, Monitors); remove_process(Key = {acceptors, _}, MonitorRef, Pid, Monitors) -> - Acceptors = ets:lookup_element(?TAB, Key, 2), - true = ets:insert(?TAB, {Key, lists:delete(Pid, Acceptors)}), + try + Acceptors = ets:lookup_element(?TAB, Key, 2), + true = ets:update_element(?TAB, Key, {2, lists:delete(Pid, Acceptors)}) + catch + error:_ -> + ok + end, lists:keydelete({MonitorRef, Pid}, 1, Monitors). |