joyent/node — pull request #7623 by juliangruber (2014-05-14 12:05:12+00:00)
Title: missing close event after EPIPE error

The documentation for a `net.Socket` states [here](http://nodejs.org/api/net.html#net_event_error_1):

> Event: 'error'#
> Error object
> Emitted when an error occurs. The 'close' event will be called directly following this event.

This does however not happen after an `EPIPE` error. I made the `net-write-after-close` test fail by waiting for that event.

I'm not sure how to fix this, of course we could just `self.emit('close')` [here](https://github.com/joyent/node/blob/master/lib/net.js#L278) in `writeAfterFIN`, but it seems like this should rather happen somewhere around [here](https://github.com/joyent/node/blob/master/lib/net.js#L261) in `onSocketEnd()` or `destroySoon()`.