diff options
Diffstat (limited to 'lib/net/tcpconn.ex')
-rw-r--r-- | lib/net/tcpconn.ex | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/net/tcpconn.ex b/lib/net/tcpconn.ex index 64c85e9..a16a62e 100644 --- a/lib/net/tcpconn.ex +++ b/lib/net/tcpconn.ex @@ -53,7 +53,7 @@ defmodule SNet.TCPConn do addr: addr, port: port } - GenServer.cast(SNet.Manager, {:peer_up, cli_pkey, self(), addr, 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}" GenServer.cast(self(), :init_pull) @@ -66,7 +66,7 @@ defmodule SNet.TCPConn do end def handle_cast(:init_pull, state) do - id_list = (for {id, _} <- GenServer.call(Shard.Manager, :list), do: id) + id_list = (for {id, _, _} <- :ets.tab2list(:shard_db), do: id) send_msg(state, {:interested, id_list}) {:noreply, state} end @@ -98,16 +98,16 @@ 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(SNet.Manager, {:peer_down, state.his_pkey, state.addr, state.port}) + GenServer.cast(Shard.Manager, {:peer_down, state.his_pkey, state.addr, state.port}) exit(:normal) end defp handle_packet({:interested, shards}, state) do - GenServer.cast(Shard.Manager, {:interested, state.his_pkey, self(), shards}) + GenServer.cast(Shard.Manager, {:interested, state.his_pkey, shards}) end defp handle_packet({shard, msg}, state) do - GenServer.cast(Shard.Manager, {:dispatch, state.his_pkey, self(), shard, msg}) + Shard.Manager.dispatch(state.his_pkey, shard, msg) end defp print_id(state) do |