Skip to content

Commit

Permalink
derper: add stun logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed May 16, 2023
1 parent 5e997a4 commit f9175ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bin/derper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,12 @@ async fn server_stun_listener(pc: tokio::net::UdpSocket) {
Ok((n, ua)) => {
let pkt = &buffer[..n];
if !stun::is(pkt) {
debug!("STUN: ignoring non stun packet from {}", ua);
continue;
}
match stun::parse_binding_request(pkt) {
Ok(txid) => {
debug!("STUN: received binding request from {}", ua);
let res = stun::response(txid, ua);
if let Err(err) = pc.send_to(&res, ua).await {
warn!("STUN: failed to write response to {}: {:?}", ua, err);
Expand All @@ -714,7 +716,7 @@ async fn server_stun_listener(pc: tokio::net::UdpSocket) {
}
}
Err(err) => {
warn!("STUN recv: {:?}", err);
warn!("STUN: failed to recv: {:?}", err);
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
}
Expand Down

0 comments on commit f9175ca

Please sign in to comment.