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

Simplify socket handling #557

Merged
merged 6 commits into from
Nov 3, 2021
Merged

Simplify socket handling #557

merged 6 commits into from
Nov 3, 2021

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented Oct 21, 2021

See individual commit messages

@Dirbaio Dirbaio force-pushed the iface-sockets branch 2 times, most recently from 2759270 to 0ce00ed Compare October 21, 2021 02:19
@Dirbaio
Copy link
Member Author

Dirbaio commented Nov 3, 2021

bors r+

bors bot added a commit that referenced this pull request Nov 3, 2021
557: Simplify socket handling r=Dirbaio a=Dirbaio

See individual commit messages

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
@bors
Copy link
Contributor

bors bot commented Nov 3, 2021

Build failed:

The intent was to run custom code after the user is done modifying the socket,
for example to update a (not yet existing) port->socket map in SocketSet. However
this wouldn't work, since the SocketRef would have to borrow the SocketSet at
the same time as the Socket to be able to notify the SocketSet.

I believe such indexing can be achieved by setting a "dirty" bit *before* giving
the socket to the user, then on poll() reindexing all dirty sockets. This could
even be faster: if user gets a socket multiple times between polls, it'd be reindexed
only once.
It is never used in practice, so it's not worth the complexity
and the extra RAM usage.
@Dirbaio
Copy link
Member Author

Dirbaio commented Nov 3, 2021

needed some rebasing

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 3, 2021

Build succeeded:

@bors bors bot merged commit a17c167 into master Nov 3, 2021
@bors bors bot deleted the iface-sockets branch November 3, 2021 22:47
bors bot added a commit that referenced this pull request Nov 26, 2021
571: socket: simplify, make SocketSet private. r=Dirbaio a=Dirbaio

This completes the work started in #557.

Since `Interface` now owns the sockets, `SocketSet` is now an implementation detail, so it is made private. 

Also `SocketMeta` is moved from each socket to the SocketSet. `SocketMeta` is arguably an `Interface` implementation detail as well, mainly used for neighbor discovery. it also reduces a bit of code duplication.

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
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.

None yet

1 participant