mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Merge #5405
5405: mastersrv: Small convenience function r=def- a=heinrich5991 ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
This commit is contained in:
commit
bbc447a995
|
@ -101,16 +101,16 @@ impl Protocol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Addr {
|
||||||
|
pub fn to_socket_addr(self) -> SocketAddr {
|
||||||
|
SocketAddr::new(self.ip, self.port)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fmt::Display for Addr {
|
impl fmt::Display for Addr {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut buf: ArrayString<[u8; 128]> = ArrayString::new();
|
let mut buf: ArrayString<[u8; 128]> = ArrayString::new();
|
||||||
write!(
|
write!(&mut buf, "{}://{}", self.protocol, self.to_socket_addr()).unwrap();
|
||||||
&mut buf,
|
|
||||||
"{}://{}",
|
|
||||||
self.protocol,
|
|
||||||
SocketAddr::new(self.ip, self.port)
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
buf.fmt(f)
|
buf.fmt(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,7 +763,7 @@ fn handle_register(
|
||||||
tokio::spawn(send_challenge(
|
tokio::spawn(send_challenge(
|
||||||
connless_request_token_7,
|
connless_request_token_7,
|
||||||
shared.socket.clone(),
|
shared.socket.clone(),
|
||||||
SocketAddr::new(addr.ip, addr.port),
|
addr.to_socket_addr(),
|
||||||
register.challenge_secret,
|
register.challenge_secret,
|
||||||
challenge.current,
|
challenge.current,
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue