send hole punch directly after storing address
This commit is contained in:
parent
869f8d04c7
commit
7d954e22f6
|
@ -142,7 +142,12 @@ impl PlayerActor {
|
|||
}
|
||||
WriteMessage::SetUdp(port) => {
|
||||
trace!("now connected on udp!");
|
||||
addr = Some(SocketAddr::new(ip, port))
|
||||
addr = Some(SocketAddr::new(ip, port));
|
||||
|
||||
let mut buf = [0; 256];
|
||||
let mut writer = Cursor::new(buf.as_mut_slice());
|
||||
write_packet(&mut writer, user_id, PacketData::HolePunch(HolePunch)).await.unwrap();
|
||||
socket.send_to(&buf, addr.as_ref().unwrap()).await.expect("kys");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue