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

Multiple read / write watchers on one stream #152

Open
kelunik opened this issue Mar 6, 2017 · 3 comments
Open

Multiple read / write watchers on one stream #152

kelunik opened this issue Mar 6, 2017 · 3 comments

Comments

@kelunik
Copy link
Member

kelunik commented Mar 6, 2017

Should multiple concurrently enabled read / write watchers on the same stream error? I can't imagine a use case and think it's an error when it happens. Multiple watchers with one enabled at a time might be fine to switch between different handlers.

One problem I can see is that watchers are enabled by default and you can't create a new watcher being disabled if one is enabled already.

@bwoebi
Copy link
Member

bwoebi commented Mar 6, 2017

It may or may not be an error … perhaps you want to peek onto the stream and log raw stream data and have the other read watcher invoked afterwards.
I'm not fond of prohibiting possible valid uses, just to make the ultra-rare case error when you've accidentally installed two watchers on the same stream (that never happened to me accidentally as far as I can remember).

@kelunik
Copy link
Member Author

kelunik commented Mar 6, 2017

@bwoebi If you install a second read watcher to consume and log the data, the data will be gone for the second read watcher and things will break.

@bwoebi
Copy link
Member

bwoebi commented Mar 6, 2017

I said peek, not consume. (e.g. stream_socket_recvfrom() with STREAM_PEEK)

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

No branches or pull requests

2 participants