Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.0"}
]
end
```
Expand Down
14 changes: 14 additions & 0 deletions lib/ice_agent.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule ExICE.MixProject do
use Mix.Project

@version "0.3.0"
@version "0.4.0"
@source_url "https://github.com/elixir-webrtc/ex_ice"

def project do
Expand Down