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

Implement close by ending the TCP socket #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

csimi
Copy link

@csimi csimi commented Jul 25, 2019

This is not defined in the RFC so it's most likely dead simple and the Adobe engineers decided it's not worth documenting.

@@ -23,7 +23,7 @@ class StreamFactory {

this.controlStream = this._pipe(new ControlStream(ChunkStreamParams))
this.userControlStream = this._pipe(new UserControlStream())
this.netConnection = this._pipe(new NetConnection())
this.netConnection = this._pipe(new NetConnection(socket))
Copy link
Owner

Choose a reason for hiding this comment

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

This approach goes against Stream Pipeline pattern.

The socket is the lowest layer of the pipeline and NetConnection must be independent of it (I wanted to separate concerns here), so constructor must not receive any parameter referencing lower layers because it is like 'short-circuiting' the pipeline. In fact, none of the entities, except Stream factory, is aware of the socket.

I am not worried about closing a connection, but in case of need, the approach should make use of .end() or .destroy() methods on Duplex Streams, listen to the triggered events and do whatever is needed on the rest of the piped entities.

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

Successfully merging this pull request may close these issues.

2 participants