Revert "Remove 'connect' event from server side sockets"
Fixes #1276
This reverts commit f0a440d886
.
This commit is contained in:
Родитель
e8542b6220
Коммит
ede1acc1ed
|
@ -955,6 +955,15 @@ function Server(/* [ options, ] listener */) {
|
|||
|
||||
DTRACE_NET_SERVER_CONNECTION(s);
|
||||
self.emit('connection', s);
|
||||
|
||||
// The 'connect' event probably should be removed for server-side
|
||||
// sockets. It's redundant.
|
||||
try {
|
||||
s.emit('connect');
|
||||
} catch (e) {
|
||||
s.destroy(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@ var client_recv_count = 0;
|
|||
var disconnect_count = 0;
|
||||
|
||||
var server = net.createServer(function(socket) {
|
||||
socket.write('hello\r\n');
|
||||
socket.addListener('connect', function() {
|
||||
socket.write('hello\r\n');
|
||||
});
|
||||
|
||||
socket.addListener('end', function() {
|
||||
socket.end();
|
||||
|
|
Загрузка…
Ссылка в новой задаче