Skip to content

Commit

Permalink
Allow to pass GenServer opts to the PeerConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 committed Apr 14, 2024
1 parent 2e48dec commit 5e96ac0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/ex_webrtc/peer_connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ defmodule ExWebRTC.PeerConnection do
|> Enum.filter(fn pid -> Process.alive?(pid) end)
end

@spec start_link(Configuration.options()) :: GenServer.on_start()
def start_link(options \\ []) do
{controlling_process, options} = Keyword.pop(options, :controlling_process)
@spec start_link(Configuration.options(), GenServer.options()) :: GenServer.on_start()
def start_link(pc_opts \\ [], gen_server_opts \\ []) do
{controlling_process, pc_opts} = Keyword.pop(pc_opts, :controlling_process)
controlling_process = controlling_process || self()
configuration = Configuration.from_options!(options)
GenServer.start_link(__MODULE__, {controlling_process, configuration})
configuration = Configuration.from_options!(pc_opts)
GenServer.start_link(__MODULE__, {controlling_process, configuration}, gen_server_opts)
end

@spec start(Configuration.options()) :: GenServer.on_start()
Expand Down

0 comments on commit 5e96ac0

Please sign in to comment.