From b8a7741524afe679c4dc79f443b1de9534a943f2 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Fri, 28 Jan 2022 22:13:10 +0000 Subject: [PATCH] fix bind_addr --- actix-server/src/builder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index ad41d056..c3bc0269 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -264,22 +264,23 @@ pub(super) fn bind_addr( addr: S, backlog: u32, ) -> io::Result> { - let mut err = None; + let mut opt_err = None; let mut success = false; let mut sockets = Vec::new(); + for addr in addr.to_socket_addrs()? { match create_mio_tcp_listener(addr, backlog) { Ok(lst) => { success = true; sockets.push(lst); } - Err(err) => err = Some(err), + Err(err) => opt_err = Some(err), } } if success { Ok(sockets) - } else if let Some(err) = err.take() { + } else if let Some(err) = opt_err.take() { Err(err) } else { Err(io::Error::new(