diff --git a/src/mastersrv/src/addr.rs b/src/mastersrv/src/addr.rs index dad5128ee..b6abaad9a 100644 --- a/src/mastersrv/src/addr.rs +++ b/src/mastersrv/src/addr.rs @@ -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 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut buf: ArrayString<[u8; 128]> = ArrayString::new(); - write!( - &mut buf, - "{}://{}", - self.protocol, - SocketAddr::new(self.ip, self.port) - ) - .unwrap(); + write!(&mut buf, "{}://{}", self.protocol, self.to_socket_addr()).unwrap(); buf.fmt(f) } } diff --git a/src/mastersrv/src/main.rs b/src/mastersrv/src/main.rs index 985ad0706..1c03f6a1b 100644 --- a/src/mastersrv/src/main.rs +++ b/src/mastersrv/src/main.rs @@ -763,7 +763,7 @@ fn handle_register( tokio::spawn(send_challenge( connless_request_token_7, shared.socket.clone(), - SocketAddr::new(addr.ip, addr.port), + addr.to_socket_addr(), register.challenge_secret, challenge.current, ));