aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/app
diff options
context:
space:
mode:
Diffstat (limited to 'shard/lib/app')
-rw-r--r--shard/lib/app/chat.ex6
-rw-r--r--shard/lib/app/identity.ex6
-rw-r--r--shard/lib/app/pagestore.ex8
3 files changed, 10 insertions, 10 deletions
diff --git a/shard/lib/app/chat.ex b/shard/lib/app/chat.ex
index 051dfef..53767ef 100644
--- a/shard/lib/app/chat.ex
+++ b/shard/lib/app/chat.ex
@@ -118,7 +118,7 @@ defmodule SApp.Chat do
end
end
- notif = {:append, prev_root, msgitem, mst.root}
+ notif = {state.id, nil, {:append, prev_root, msgitem, mst.root}}
SNet.Group.broadcast(state.group, notif)
{:noreply, state}
@@ -130,7 +130,7 @@ defmodule SApp.Chat do
"""
def handle_cast({:interested, conn_pid, auth}, state) do
if SNet.Group.in_group?(state.group, conn_pid, auth) do
- Shard.Manager.send_pid(conn_pid, {state.id, nil, {:root, state.mst.root}})
+ SNet.Manager.send_pid(conn_pid, {state.id, nil, {:root, state.mst.root}})
end
{:noreply, state}
end
@@ -157,7 +157,7 @@ defmodule SApp.Chat do
else
state = case msg do
{:get_manifest} ->
- Shard.Manager.send_pid(conn_pid, {state.id, nil, {:manifest, state.manifest}})
+ SNet.Manager.send_pid(conn_pid, {state.id, nil, {:manifest, state.manifest}})
state
{:append, prev_root, msgitem, new_root} ->
# Append message: one single mesage has arrived
diff --git a/shard/lib/app/identity.ex b/shard/lib/app/identity.ex
index d2748a1..391d37e 100644
--- a/shard/lib/app/identity.ex
+++ b/shard/lib/app/identity.ex
@@ -84,14 +84,14 @@ defmodule SApp.Identity do
end
def handle_cast(:init_pull, state) do
- for {_, pid, _} <- Shard.Manager.list_connections do
+ for {_, pid, _} <- SNet.Manager.list_connections do
GenServer.cast(pid, {:send_msg, {:interested, [state.id]}})
end
{:noreply, state}
end
def handle_cast({:interested, peer_pid, _auth}, state) do
- Shard.Manager.send_pid(peer_pid, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
+ SNet.Manager.send_pid(peer_pid, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
{:noreply, state}
end
@@ -115,7 +115,7 @@ defmodule SApp.Identity do
def bcast_state(state, exclude \\ []) do
for peer_id <- Shard.Manager.get_shard_peers(state.id) do
if not Enum.member? exclude, peer_id do
- Shard.Manager.send(peer_id, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
+ SNet.Manager.send(peer_id, {state.id, nil, {:update, SData.SignRev.signed(state.state)}})
end
end
end
diff --git a/shard/lib/app/pagestore.ex b/shard/lib/app/pagestore.ex
index e09c513..ad18eac 100644
--- a/shard/lib/app/pagestore.ex
+++ b/shard/lib/app/pagestore.ex
@@ -107,7 +107,7 @@ defmodule SApp.PageStore do
case prefer_ask do
[_|_] ->
for peer <- prefer_ask do
- Shard.Manager.send_pid(peer, {state.shard_id, state.path, {:get, key}})
+ SNet.Manager.send_pid(peer, {state.shard_id, state.path, {:get, key}})
end
_ ->
ask_random_peers(state, key)
@@ -128,9 +128,9 @@ defmodule SApp.PageStore do
{:get, key} ->
case :dets.lookup state.store, key do
[{_, _, bin}] ->
- Shard.Manager.send_pid(conn_pid, {state.shard_id, state.path, {:info, key, bin}})
+ SNet.Manager.send_pid(conn_pid, {state.shard_id, state.path, {:info, key, bin}})
_ ->
- Shard.Manager.send_pid(conn_pid, {state.shard_id, state.path, {:not_found, key}})
+ SNet.Manager.send_pid(conn_pid, {state.shard_id, state.path, {:not_found, key}})
end
state
{:info, hash, bin} ->
@@ -251,7 +251,7 @@ defmodule SApp.PageStore do
|> Enum.shuffle
|> Enum.take(3)
for peer <- peers do
- Shard.Manager.send(peer, {state.shard_id, state.path, {:get, key}})
+ SNet.Manager.send(peer, {state.shard_id, state.path, {:get, key}})
end
end