From 04f6ca6f2ef8f2f42980349b1db70ba577b6026c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christopher=20Cot=C3=A9?= Date: Wed, 10 Nov 2021 14:28:05 -0500 Subject: [PATCH] update handler and version --- lib/client/handler.ex | 14 +++++++++++--- mix.exs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/client/handler.ex b/lib/client/handler.ex index 0bf7adb..fdff335 100644 --- a/lib/client/handler.ex +++ b/lib/client/handler.ex @@ -25,9 +25,15 @@ defmodule Wampex.Client.Handler do {cn, opts} = Keyword.pop(opts, :client_name) state = do_init(opts) Client.add(cn, self()) - {:ok, %{state | client_name: cn}} + {:ok, add_client(state, cn)} end + defp add_client(state, cn) when is_struct(state) do + struct(state, %{client_name: cn}) + end + + defp add_client(state, cn), do: %{state | client_name: cn} + @impl true def handle_continue({:registered, _}, state), do: {:noreply, state} @@ -86,7 +92,8 @@ defmodule Wampex.Client.Handler do quote location: :keep do alias Wampex.Roles.Dealer.Invocation - @procedures [unquote(procedure) | @procedures] + procs = Module.get_attribute(__MODULE__, :procedures) + Module.put_attribute(__MODULE__, :procedures, [unquote(procedure) | procs]) @impl true def handle_info( @@ -109,7 +116,8 @@ defmodule Wampex.Client.Handler do alias Wampex.Client alias Wampex.Roles.Broker.Event - @topics [unquote(topic) | @topics] + topics = Module.get_attribute(__MODULE__, :topics) + Module.put_attribute(__MODULE__, :topics, [unquote(topic) | topics]) @impl true def handle_info( diff --git a/mix.exs b/mix.exs index 83959f6..f7aac89 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Wampex.Client.MixProject do def project do [ app: :wampex_client, - version: "0.1.1", + version: "0.1.2", elixir: "~> 1.9", start_permanent: Mix.env() == :prod, elixirc_paths: elixirc_paths(Mix.env()), -- 2.45.3