stream interface should provide destroy() method #5

Closed
mlin opened this Issue Jul 24, 2012 · 0 comments

Comments

Projects
None yet
2 participants
@mlin

mlin commented Jul 24, 2012

The stream interface example in README.md uses node's Stream.pipe to send data to clarinet. Stream.pipe assumes that the destination stream (in this case clarinet) implements a destroy() method, which it invokes in the event of an abrupt close of the source stream.

https://github.com/joyent/node/blob/master/lib/stream.js#L74

This will happen, for example, if we are piping from a socket and the socket is abruptly disconnected. Since clarinet's stream does not provide destroy(), this chain results in an error in the global scope such as the following:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Object #<CStream> has no method 'destroy'
    at IncomingMessage.onclose (stream.js:98:10)
    at IncomingMessage.emit (events.js:88:20)
    at abortIncoming (http.js:1386:11)
    at Socket.<anonymous> (http.js:1459:5)
    at Socket.emit (events.js:88:20)
    at Array.0 (net.js:320:10)
    at EventEmitter._tickCallback (node.js:192:40)

dscape added a commit that referenced this issue Jul 24, 2012

@dscape dscape closed this in 3e19fbc Jul 24, 2012

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