diff options
Diffstat (limited to 'shard/lib/net/tcpconn.ex')
-rw-r--r-- | shard/lib/net/tcpconn.ex | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/shard/lib/net/tcpconn.ex b/shard/lib/net/tcpconn.ex index bd169aa..7025ffe 100644 --- a/shard/lib/net/tcpconn.ex +++ b/shard/lib/net/tcpconn.ex @@ -296,6 +296,11 @@ defmodule SNet.TCPConn do {:noreply, %{state | nonce_send: next_nonce(state.nonce_send) }} end + def handle_cast(:close, state) do + Logger.info "Closing: #{print_id state} at #{inspect state.peer_info}" + exit(:normal) + end + def handle_info({:tcp, _socket, raw_data}, state) do {:ok, msgbin} = :enacl.secretbox_open(raw_data, state.nonce_recv, state.secret_recv) msg_data = :erlang.binary_to_term(msgbin, [:safe]) |