File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -155,9 +155,9 @@ impl<F: RuntimeFactors> HttpServer<F> {
155155 } else {
156156 TcpListener :: bind ( self . listen_addr ) . await . map_err ( |err| {
157157 if err. kind ( ) == ErrorKind :: AddrInUse {
158- anyhow:: anyhow!( "Unable to listen on {} . To have Spin search for a free port, use the --find-free-port option." , self . listen_addr)
158+ anyhow:: anyhow!( "{} is already in use . To have Spin search for a free port, use the --find-free-port option." , self . listen_addr)
159159 } else {
160- anyhow:: anyhow!( "Unable to listen on {}" , self . listen_addr)
160+ anyhow:: anyhow!( "Unable to listen on {}: {err:?} " , self . listen_addr)
161161 }
162162 } ) ?
163163 } ;
@@ -181,14 +181,15 @@ impl<F: RuntimeFactors> HttpServer<F> {
181181 ) ;
182182 }
183183
184- addr. set_port ( addr. port ( ) + 1 ) ;
185-
186184 match TcpListener :: bind ( addr) . await {
187185 Ok ( listener) => {
188186 found_listener = Some ( listener) ;
189187 break ;
190188 }
191- Err ( err) if err. kind ( ) == ErrorKind :: AddrInUse => continue ,
189+ Err ( err) if err. kind ( ) == ErrorKind :: AddrInUse => {
190+ addr. set_port ( addr. port ( ) + 1 ) ;
191+ continue ;
192+ }
192193 Err ( err) => anyhow:: bail!( "Unable to listen on {addr}: {err:?}" , ) ,
193194 }
194195 }
You can’t perform that action at this time.
0 commit comments