From 9fc3e1cf2d35d5f9ce63629c7441065a0f62d92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=9Aled=C5=BA?= Date: Fri, 15 Dec 2023 11:31:02 +0100 Subject: [PATCH 1/3] Add stop/1 --- lib/ice_agent.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/ice_agent.ex b/lib/ice_agent.ex index cd76e7c..be2f6af 100644 --- a/lib/ice_agent.ex +++ b/lib/ice_agent.ex @@ -217,6 +217,14 @@ defmodule ExICE.ICEAgent do GenServer.cast(ice_agent, :restart) end + @doc """ + Stops ICE agent and all of its sockets. + """ + @spec stop(pid()) :: :ok + def stop(ice_agent) do + GenServer.stop(ice_agent) + end + ### Server @impl true @@ -588,6 +596,12 @@ defmodule ExICE.ICEAgent do {:noreply, state} end + @impl true + def terminate(reason, _state) do + # we don't need to close sockets manually as this is done automatically by Erlang + Logger.debug("Stopping ICE agent with reason: #{inspect(reason)}") + end + defp do_add_remote_candidate(remote_cand, state) do local_cands = get_matching_candidates(state.local_cands, remote_cand) From f6aea8263ef7deb0e383b87ad643fc7fa5a18f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=9Aled=C5=BA?= Date: Fri, 15 Dec 2023 11:33:30 +0100 Subject: [PATCH 2/3] Bump version to 0.3.1 --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd654fc..59e250c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ as WebRTC multiplexes traffic on a single socket but PRs are welcomed ```elixir def deps do [ - {:ex_ice, "~> 0.3.0"} + {:ex_ice, "~> 0.3.1"} ] end ``` diff --git a/mix.exs b/mix.exs index 0188d3e..082f1ae 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule ExICE.MixProject do use Mix.Project - @version "0.3.0" + @version "0.3.1" @source_url "https://github.com/elixir-webrtc/ex_ice" def project do From 31b668b5590ede34d0e750ad74aca549dd005a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=9Aled=C5=BA?= Date: Mon, 18 Dec 2023 11:39:44 +0100 Subject: [PATCH 3/3] Bump version to 0.4.0 --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59e250c..43ed8d3 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ as WebRTC multiplexes traffic on a single socket but PRs are welcomed ```elixir def deps do [ - {:ex_ice, "~> 0.3.1"} + {:ex_ice, "~> 0.4.0"} ] end ``` diff --git a/mix.exs b/mix.exs index 082f1ae..8cb2777 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule ExICE.MixProject do use Mix.Project - @version "0.3.1" + @version "0.4.0" @source_url "https://github.com/elixir-webrtc/ex_ice" def project do