Skip to content

Commit

Permalink
Improve socket control transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Noarkhh committed Apr 24, 2024
1 parent 293c231 commit 66f5dd6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/membrane_rtsp/rtsp.ex
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ defmodule Membrane.RTSP do
_from,
%State{socket: socket} = state
) do
:ok = :gen_tcp.controlling_process(socket, new_controlling_process)
{:reply, socket, state}
case :gen_tcp.controlling_process(socket, new_controlling_process) do
:ok -> {:reply, {:ok, socket}, state}
{:error, :not_owner} -> {:reply, {:error, :not_owner}, state}
end
end

def handle_call({:parse_response, raw_response}, _from, state) do
Expand Down Expand Up @@ -148,7 +150,7 @@ defmodule Membrane.RTSP do

@type headers :: [{binary(), binary()}]

@spec get_socket_control(t(), pid()) :: :gen_tcp.socket()
@spec get_socket_control(t(), pid()) :: {:ok, :gen_tcp.socket()} | {:error, :not_owner}
def get_socket_control(session, new_controlling_process) do
GenServer.call(session, {:get_socket_control, new_controlling_process})
end
Expand Down

0 comments on commit 66f5dd6

Please sign in to comment.