Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Avoid socket re-registeration #1087

Open
ustulation opened this issue Dec 12, 2018 · 0 comments
Open

Avoid socket re-registeration #1087

ustulation opened this issue Dec 12, 2018 · 0 comments

Comments

@ustulation
Copy link
Contributor

More details here in the review comment.

Summarising again, the uniform idiom should be to just read in a loop. If you collect many msgs and only one is meant to be handled by the current state, then pass the remainder over to the next state. Similarly never re-register to write (or avoid it unless impossible to do without it). Just write instead. Start with registering once for read and write with edge notification and work your way from there.

This avoids forgetting the correct re-registerations and undoing previous ones and doing new ones etc. Doing all that is utterly nuanced, error prone, causes breakages easily during code changes and makes it difficult to reason about properly in reviews.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants