]> Entropealabs - wampex_router.git/commitdiff
send error to caller peer when callee goes away
authorChristopher <chris@entropealabs.com>
Mon, 6 Apr 2020 15:01:13 +0000 (10:01 -0500)
committerChristopher <chris@entropealabs.com>
Mon, 6 Apr 2020 15:01:13 +0000 (10:01 -0500)
lib/router/session.ex
mix.lock

index fe5cbeb8c73570cc3c44a48f58224c048035e432..1e6f5410165673e97a99c7bf135ab3fa365966f9 100644 (file)
@@ -651,10 +651,19 @@ defmodule Wampex.Router.Session do
           transport_pid: t,
           registrations: regs,
           realm: realm,
-          subscriptions: subs
+          subscriptions: subs,
+          invocations: inv,
+          proxy: proxy
         }
       }) do
-    Logger.debug("Router session terminating #{inspect(reason)}")
+    debug("Router session terminating #{inspect(reason)}")
+
+    Enum.each(inv, fn {call_id, _, {pid, node}} ->
+      send(
+        {proxy, node},
+        {%Error{request_id: call_id, type: @call, error: "wamp.error.callee_went_away"}, pid}
+      )
+    end)
 
     Enum.each(regs, fn {id, _proc} ->
       RealmSession.unregister(db, realm, {id, {self(), Node.self()}}, regs)
index ad675bf3096f1e193e2281a70ef6c24d8f2cab87..84cdfe2a1e3e806fe32d659509ee7ab0e8d28dc1 100644 (file)
--- a/mix.lock
+++ b/mix.lock
@@ -37,7 +37,7 @@
   "telemetry": {:hex, :telemetry, "0.4.1", "ae2718484892448a24470e6aa341bc847c3277bfb8d4e9289f7474d752c09c7f", [:rebar3], [], "hexpm", "4738382e36a0a9a2b6e25d67c960e40e1a2c95560b9f936d8e29de8cd858480f"},
   "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"},
   "wampex": {:git, "https://gitlab.com/entropealabs/wampex.git", "7d656d9748cb0e4d08c625d87e315839afecb4b2", [tag: "7d656d9748cb0e4d08c625d87e315839afecb4b2"]},
-  "wampex_client": {:git, "https://gitlab.com/entropealabs/wampex_client.git", "7896d51d7493fd3477de2a226d7d97f2c3098736", [tag: "7896d51d7493fd3477de2a226d7d97f2c3098736"]},
+  "wampex_client": {:git, "https://gitlab.com/entropealabs/wampex_client.git", "a6478667525bbc048215a94ec237a6b45f9009f1", [tag: "a6478667525bbc048215a94ec237a6b45f9009f1"]},
   "websockex": {:hex, :websockex, "0.4.2", "9a3b7dc25655517ecd3f8ff7109a77fce94956096b942836cdcfbc7c86603ecc", [:mix], [], "hexpm", "803cd76e91544b56f0e655e36790be797fa6436db9224f7c303db9b9df2a3df4"},
   "xema": {:hex, :xema, "0.11.0", "7b5118418633cffc27092110d02d4faeea938149dd3f6c64299e41e747067e80", [:mix], [{:conv_case, "~> 0.2.2", [hex: :conv_case, repo: "hexpm", optional: false]}, {:decimal, "~> 1.7", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "51491c9a953d65069d4b30aa2f70bc45ff99fd1bc3345bc72ce4e644d01ea14e"},
 }