Skip to content

Conversation

@fasuizu-br
Copy link

Summary

SntpRequest::new() uses .unwrap() on UdpSocket::bind() and set_timeout(), which panics if the socket cannot be created. Added try_new() that returns io::Result<SntpRequest> and documented the panic condition on new().

Closes #11

Test plan

  • cargo check passes
  • cargo test — all tests pass

Add try_new() that returns io::Result<SntpRequest> instead of panicking
when UdpSocket::bind() or set_timeout() fails. Document the panic
condition on new() and delegate to try_new().expect().

Closes risoflora#11
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.

Bug: UdpSocket::bind().unwrap() in constructor can panic

1 participant