-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Feature request: add a delegate to be called before writing to the stream #2
Comments
Can you elaborate on why this is useful and can't be reached another way? This doesn't feel like natural stream behavior to have a callback like this. |
This is to support unit tests of streamjsonrpc. In this PR we have to copy-paste FullDuplexStream to achieve it. The idea is to be able to know when writes happen |
Could you do that by having a Read or ReadAsync call waiting for the Write operation to come in? Or is that too late? |
Do you mean, can we have a delegate that fires when data arrives to the read end after being written to the duplex stream? I didn't check if this gives us the same timing. In the duplex stream sources it looks like reading is async after writing, so it won't work for us. |
I don't mean a delegate. I just mean you have a reader which will unblock as soon as the writer writes to the stream. Yes, this would be slightly later timing than your proposed delegate before writing would give you. I'm at a loss to think of how to achieve your requirement without adding a rather unnatural "feature" to this library. So I'm leaning toward encouraging you to keep your forked copy of the code for your testing purposes. Ah, the joys of open source. Is there any particular reason that you see that this would be a painful end? |
Something like this:
The text was updated successfully, but these errors were encountered: