diff options
author | Alex Auvolat <alex@adnab.me> | 2018-08-27 22:40:34 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-08-27 22:40:34 +0200 |
commit | 0faa792c979788efb8cf8b80a3534f770d8b1a65 (patch) | |
tree | 5a3a7feb5a7ea5c9f764b6d324a0a0ccd9bebe55 | |
parent | 233989490b0b01670b03154f9e8f83be13e5a89a (diff) | |
download | shard-0faa792c979788efb8cf8b80a3534f770d8b1a65.tar.gz shard-0faa792c979788efb8cf8b80a3534f770d8b1a65.zip |
Fix port issues
-rw-r--r-- | lib/application.ex | 2 | ||||
-rw-r--r-- | lib/net/tcpconn.ex | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/application.ex b/lib/application.ex index f933019..eef02f0 100644 --- a/lib/application.ex +++ b/lib/application.ex @@ -22,7 +22,7 @@ defmodule Shard.Application do { SNet.TCPServer, listen_port }, # Applications & data store - Shard.Manager, + { Shard.Manager, listen_port }, # Web UI # Plug.Adapters.Cowboy.child_spec(:http, SWeb.HTTPRouter, [], port: listen_port + 1000) diff --git a/lib/net/tcpconn.ex b/lib/net/tcpconn.ex index a16a62e..7d82601 100644 --- a/lib/net/tcpconn.ex +++ b/lib/net/tcpconn.ex @@ -51,7 +51,8 @@ defmodule SNet.TCPConn do conn_my_skey: sess_skey, conn_his_pkey: cli_sess_pkey, addr: addr, - port: port + port: port, + his_port: his_port } GenServer.cast(Shard.Manager, {:peer_up, cli_pkey, self(), addr, his_port}) Logger.info "New peer: #{print_id state} at #{inspect addr}:#{port}" @@ -98,7 +99,7 @@ defmodule SNet.TCPConn do def handle_info({:tcp_closed, _socket}, state) do Logger.info "Disconnected: #{print_id state} at #{inspect state.addr}:#{state.port}" - GenServer.cast(Shard.Manager, {:peer_down, state.his_pkey, state.addr, state.port}) + GenServer.cast(Shard.Manager, {:peer_down, state.his_pkey, state.addr, state.his_port}) exit(:normal) end |