diff options
Diffstat (limited to 'shard')
-rw-r--r-- | shard/lib/net/tcpconn.ex | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/shard/lib/net/tcpconn.ex b/shard/lib/net/tcpconn.ex index 7025ffe..21d25df 100644 --- a/shard/lib/net/tcpconn.ex +++ b/shard/lib/net/tcpconn.ex @@ -47,7 +47,10 @@ defmodule SNet.TCPConn do def handle_cast(:client_handshake, state) do {:inet, ip, port} = state.connect_to - {:ok, socket} = :gen_tcp.connect(ip, port, [:binary, packet: 2, active: false]) + socket = case :gen_tcp.connect(ip, port, [:binary, packet: 2, active: false]) do + {:ok, socket} -> socket + _ -> exit(:normal) # ignore connection errors + end net_key = Application.get_env(:shard, :network_key) %{public: cli_eph_pk, secret: cli_eph_sk} = :enacl.box_keypair @@ -152,7 +155,7 @@ defmodule SNet.TCPConn do Logger.info "New peer: #{print_id state} at #{inspect addr}:#{port}" {:noreply, state} :redundant -> - exit :redundant + exit(:normal) end end @@ -280,7 +283,7 @@ defmodule SNet.TCPConn do Logger.info "New peer: #{print_id state} at #{inspect state.peer_info} (#{port})" {:noreply, state} :redundant -> - exit(:redundant) + exit(:normal) end end |