Skip to content

p2p: fail cleanly when listen bind fails#3

Open
mooncitydev wants to merge 1 commit intohacash:mainfrom
mooncitydev:fix/p2p-bind-graceful
Open

p2p: fail cleanly when listen bind fails#3
mooncitydev wants to merge 1 commit intohacash:mainfrom
mooncitydev:fix/p2p-bind-graceful

Conversation

@mooncitydev
Copy link
Copy Markdown

what was wrong

the http api server already checks TcpListener::bind and prints an error if the port cannot be opened. the p2p listener did .unwrap() on the same operation, so a busy port or other bind error crashed the whole process with a panic.

what changed

  • P2PManage::server now returns io::Result instead of panicking.
  • event_loop prints a clear message and returns errf! like the api server path, so operators get a normal shutdown path instead of a thread panic.

this matches the behavior of server_listen in the server crate.


made by mooncitydev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant