aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/application.ex2
-rw-r--r--lib/net/tcpconn.ex5
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