Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding UDP socket close functionality #482

Merged
merged 6 commits into from
Jun 9, 2021

Conversation

ryan-summers
Copy link
Contributor

This PR fixes #475 by adding a close() method to UDP sockets to unbind from the current endpoint.

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable!

What happens with the packets in rx_buffer/tx_buffer when the socket is closed and reopened (possibly with a different endpoint)? Should they be cleared?

src/socket/udp.rs Show resolved Hide resolved
@ryan-summers
Copy link
Contributor Author

I've added a new PacketBuffer::clear() API to allow us to flush the RX/TX buffer of the socket when closing it. Good catch there.

@ryan-summers ryan-summers requested a review from Dirbaio May 31, 2021 16:08
Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Thanks :)

@Dirbaio Dirbaio enabled auto-merge May 31, 2021 16:25
auto-merge was automatically disabled June 9, 2021 09:14

Head branch was pushed to by a user without write access

@ryan-summers ryan-summers requested a review from Dirbaio June 9, 2021 09:55
@Dirbaio Dirbaio enabled auto-merge June 9, 2021 14:04
@Dirbaio Dirbaio merged commit de0586e into smoltcp-rs:master Jun 9, 2021
@ryan-summers ryan-summers deleted the rs/issue-475/udp-rebinding branch June 9, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Udp rebinding / closing
2 participants