From 0faa792c979788efb8cf8b80a3534f770d8b1a65 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 27 Aug 2018 22:40:34 +0200 Subject: Fix port issues --- lib/application.ex | 2 +- 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 -- cgit v1.2.3