Skip to content

Commit

Permalink
test: fix racey-ness in tls-inception
Browse files Browse the repository at this point in the history
Fix test failure on FreeBSD and SmartOS, which happens due to a bad
timing:

    events.js:141
          throw er; // Unhandled 'error' event
                ^
    Error: read ECONNRESET
        at exports._errnoException (util.js:734:11)
        at TLSWrap.onread (net.js:538:26)

The outer `net.conncet()` socket stays alive after the inner socket is
gone. This happens because `.pipe()`'s implementation does not `destroy`
the source side when the destination has emitted `close`.

Fix: #1012
PR-URL: #1040
Reviewed-By: Chris Dickinson <[email protected]>
  • Loading branch information
indutny committed Mar 3, 2015
1 parent e0835c9 commit e1bf670
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/parallel/test-tls-inception.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ a = tls.createServer(options, function (socket) {
var dest = net.connect(options);
dest.pipe(socket);
socket.pipe(dest);

dest.on('close', function() {
socket.destroy();
});
});

// the "target" server
Expand Down

0 comments on commit e1bf670

Please sign in to comment.