From: Christopher Coté Date: Wed, 10 Nov 2021 19:28:05 +0000 (-0500) Subject: update handler and version X-Git-Url: http://git.entropealabs.com/?a=commitdiff_plain;h=04f6ca6f2ef8f2f42980349b1db70ba577b6026c;p=wampex_client.git update handler and version --- 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()),