Skip to content
Browse files

correctly close connection

if the connection was closed by the client, we never closed our end,
causing the connections to linger around in CLOSE_WAIT forever.

Clients tend to disconnect without sending QUIT on the first occurrence
of a 5xx response which does happen here and then
  • Loading branch information...
pilif committed Jul 1, 2010
1 parent cf4ae8b commit a95d80720af58d5495a2cd9f63c2e5c88e73c3f6
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/smtp/server.js
@@ -52,9 +52,13 @@ SMTPSession.prototype.connect = function( socket ) {
session.receive( packet )
socket.addListener( 'end', function() {
// close on our end. If we don't, remotely closed connections will stay half
// open forever (in CLOSE_WAIT) or until we die of handle starvation or OOM
if ( this.listeners('end').length >= 0 ) {
session.emit( 'end', session );

// following two callbacks are not used at this time

0 comments on commit a95d807

Please sign in to comment.
You can’t perform that action at this time.