aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/app/identity.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-10-10 16:48:38 +0200
committerAlex Auvolat <alex@adnab.me>2018-10-10 16:48:38 +0200
commit7bdd60c7f99df417b2589f0e99ff16abc8e925c5 (patch)
tree8508404c74bf91c453f4679363dc25680de02b56 /shard/lib/app/identity.ex
parent1ee9c3fa6d4259d63685aea95d23b515f59a74cf (diff)
downloadshard-7bdd60c7f99df417b2589f0e99ff16abc8e925c5.tar.gz
shard-7bdd60c7f99df417b2589f0e99ff16abc8e925c5.zip
Connecting works, but the rest probably doesnt
Diffstat (limited to 'shard/lib/app/identity.ex')
-rw-r--r--shard/lib/app/identity.ex10
1 files changed, 5 insertions, 5 deletions
diff --git a/shard/lib/app/identity.ex b/shard/lib/app/identity.ex
index 204dfb1..de39c6d 100644
--- a/shard/lib/app/identity.ex
+++ b/shard/lib/app/identity.ex
@@ -87,25 +87,25 @@ defmodule SApp.Identity do
end
def handle_cast(:init_pull, state) do
- for {_, pid, _, _} <- Shard.Manager.list_peers do
+ for {_, pid, _} <- Shard.Manager.list_connections do
GenServer.cast(pid, {:send_msg, {:interested, [state.id]}})
end
{:noreply, state}
end
- def handle_cast({:interested, peer_id}, state) do
- Shard.Manager.send(peer_id, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
+ def handle_cast({:interested, peer_pid, _auth}, state) do
+ Shard.Manager.send_pid(peer_pid, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
{:noreply, state}
end
- def handle_cast({:msg, peer_id, _shard_id, nil, msg}, state) do
+ def handle_cast({:msg, conn_pid, _auth, _shard_id, nil, msg}, state) do
state = case msg do
{:update, signed} when signed != nil ->
case SData.SignRev.merge(state.state, signed, state.pk) do
{true, st2} ->
Shard.Manager.save_state(state.id, st2)
state = put_in(state.state, st2)
- bcast_state(state, [peer_id])
+ bcast_state(state, [conn_pid])
state
{false, _} ->
state