Skip to content

Commit

Permalink
Add debug logging for internal relaying
Browse files Browse the repository at this point in the history
  • Loading branch information
weiss committed Oct 7, 2023
1 parent 16918ca commit 69916e4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/turn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,15 @@ send_peer(#state{relay_sock = Sock,
{Addr, PeerPort} = Peer, Data) -> % Relay and peer address are identical.
case turn_sm:find_relay(Peer) of
{ok, Pid} ->
?LOG_INFO("Relaying TURN packet internally"),
Pid ! {udp, self(), Addr, RelayPort, Data};
{error, notfound} ->
?LOG_INFO("Relaying TURN packet via UDP (no process found)"),
gen_udp:send(Sock, Addr, PeerPort, Data)
end,
count_sent(State, Data);
send_peer(#state{relay_sock = Sock} = State, {PeerAddr, PeerPort}, Data) ->
?LOG_INFO("Relaying TURN packet via UDP (src/dst addresses don't match)"),
gen_udp:send(Sock, PeerAddr, PeerPort, Data),
count_sent(State, Data).

Expand Down

0 comments on commit 69916e4

Please sign in to comment.