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