-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-switch port when getting AddrInUse error (#4314)
Closes #4241 Allows for multiple rr.serve() sessions open by trying different ports if the defaults are already in use. This is achieved by attempting to bind to port 0, which signals the OS to choose a free port. Some notes: Since the hyper::Error type does not provide a method to directly check if the error is due to a port being already in use, I checked the error string to implement this. I'm also ignoring the error thrown by format!("{bind_ip}:0").parse() as it's not possible to convert it into a hyper::Error.
- Loading branch information
Showing
2 changed files
with
22 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters