Fix process leak
This commit is contained in:
parent
7f3bb357db
commit
93f8432bd1
@ -48,9 +48,6 @@ defmodule Amethyst.ConnectionHandler do
|
||||
@spec loop(:gen_tcp.socket(), atom(), integer(), map()) :: no_return()
|
||||
defp loop(socket, connstate, version, state) do
|
||||
receive do
|
||||
:closed ->
|
||||
Logger.info("Connection #{inspect(socket)} closed.")
|
||||
Process.exit(self(), :normal)
|
||||
{:disconnect, reason} ->
|
||||
disconnect(socket, reason, connstate, version, state)
|
||||
Process.exit(self(), :normal)
|
||||
@ -109,6 +106,9 @@ defmodule Amethyst.ConnectionHandler do
|
||||
after 0 ->
|
||||
# Received stuff from the connection receiver is lower priority
|
||||
receive do
|
||||
:closed ->
|
||||
Logger.info("Connection #{inspect(socket)} closed.")
|
||||
Process.exit(self(), :normal)
|
||||
{:get_encryption, from} ->
|
||||
send(from, Map.get(state, :decryption_state))
|
||||
loop(socket, connstate, version, state)
|
||||
|
Loading…
Reference in New Issue
Block a user