net: Provide better error when writing after FIN
authorisaacs <i@izs.me>
Sat, 2 Mar 2013 18:20:33 +0000 (10:20 -0800)
committerisaacs <i@izs.me>
Sat, 2 Mar 2013 19:26:39 +0000 (11:26 -0800)
commit2106ef000c7d891385d5480a61d95327caf8e277
treecd77e0c4e60727557947003737786a1ad7f7f88c
parent47e115063b24e83fe72acb36f76667ba2216cdd5
net: Provide better error when writing after FIN

The stock writable stream "write after end" message is overly vague, if
you have clearly not called end() yourself yet.

When we receive a FIN from the other side, and call destroySoon() as a
result, then generate an EPIPE error (which is what would happen if you
did actually write to the socket), with a message explaining what
actually happened.
lib/_stream_writable.js
lib/net.js
test/simple/test-socket-write-after-fin-error.js [new file with mode: 0644]
test/simple/test-socket-write-after-fin.js [new file with mode: 0644]