diff options
Diffstat (limited to 'shard/lib/app/chat.ex')
-rw-r--r-- | shard/lib/app/chat.ex | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/shard/lib/app/chat.ex b/shard/lib/app/chat.ex index 8d55cda..8c55869 100644 --- a/shard/lib/app/chat.ex +++ b/shard/lib/app/chat.ex @@ -228,6 +228,7 @@ defmodule SApp.Chat do GenServer.cast(state.page_store, {:set_roots, [mst2.root]}) save_state(state) msg_callback(state, msgitem) + SNet.Group.broadcast(state.netgroup, {state.id, nil, msg}, exclude_pid: [conn_pid]) state else Logger.warn("Invalid new root after inserting same message item!") @@ -262,6 +263,8 @@ defmodule SApp.Chat do end defp init_merge(state, new_root, source_peer_pid) do + old_root = state.mst.root + if new_root == nil do state else @@ -291,6 +294,9 @@ defmodule SApp.Chat do GenServer.cast(state.page_store, {:set_roots, [mst.root]}) state = %{state | mst: mst} save_state(state) + if state.mst.root != old_root do + SNet.Group.broadcast(state.netgroup, {state.id, nil, {:root, state.mst.root, false}}, exclude_pid: [source_peer_pid]) + end state else Logger.warn("Incorrect signatures somewhere while merging, dropping merged data") |