net: omit superfluous 'connect' event
authorBen Noordhuis <info@bnoordhuis.nl>
Thu, 28 Feb 2013 22:25:29 +0000 (23:25 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 1 Mar 2013 01:09:36 +0000 (02:09 +0100)
commitc11612026fa28f7aedc60c577120f87d86fc15bf
treefa8db63554147b3c0fb090df2fca9c85cc21cf5a
parentbb431531a37411803abc152c1489e7430672783a
net: omit superfluous 'connect' event

Don't emit a 'connect' event on sockets that are handed off to
net.Server 'connection' event listeners.

1. It's superfluous because the connection has already been established
   at that point.

2. The implementation is arguably wrong because the event is emitted on
   the same tick of the event loop while the rule of thumb is to always
   emit it on the next one.

This has been tried before in commit f0a440d but was reverted again in
ede1acc because the change was incomplete (at least one test hadn't
been updated).

Fixes #1047 (again).
lib/net.js
test/pummel/test-net-throttle.js
test/simple/test-net-reconnect.js