File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -1185,7 +1185,7 @@ Agent.prototype._establishNewConnection = function() {
11851185 parser . incoming = null ;
11861186
11871187 socket . on ( 'error' , function ( err ) {
1188- debug ( 'AGENT SOCKET ERROR: ' + err . message ) ;
1188+ debug ( 'AGENT SOCKET ERROR: ' + err . message + '\n' + err . stack ) ;
11891189 var req ;
11901190 if ( socket . _httpMessage ) {
11911191 req = socket . _httpMessage ;
Original file line number Diff line number Diff line change @@ -844,7 +844,12 @@ Socket.prototype._shutdown = function() {
844844 try {
845845 this . _shutdownImpl ( ) ;
846846 } catch ( e ) {
847- this . destroy ( e ) ;
847+ if ( e . code == 'ENOTCONN' ) {
848+ // Allowed.
849+ this . destroy ( ) ;
850+ } else {
851+ this . destroy ( e ) ;
852+ }
848853 }
849854 } else {
850855 // writable but not readable
Original file line number Diff line number Diff line change 1+ var assert = require ( 'assert' ) ;
2+ var https = require ( 'https' ) ;
3+ var tls = require ( 'tls' ) ;
4+
5+ var options = {
6+ host : 'github.com' ,
7+ path : '/kriskowal/tigerblood/' ,
8+ port : 443
9+ } ;
10+
11+ var req = https . get ( options , function ( response ) {
12+ var recved = 0 ;
13+
14+ response . on ( 'data' , function ( chunk ) {
15+ recved += chunk . length ;
16+ console . log ( 'Response data.' ) ;
17+ } ) ;
18+
19+ response . on ( 'end' , function ( ) {
20+ console . log ( 'Response end.' ) ;
21+ // Does not work
22+ loadDom ( ) ;
23+ } ) ;
24+
25+ } ) ;
26+
27+ req . on ( 'error' , function ( e ) {
28+ console . log ( 'Error on get.' ) ;
29+ } ) ;
30+
31+ function loadDom ( ) {
32+ // Do a lot of computation to stall the process.
33+ // In the meantime the socket will be disconnected.
34+ for ( var i = 0 ; i < 1e8 ; i ++ ) {
35+ ;
36+ }
37+
38+ console . log ( 'Dom loaded.' ) ;
39+ }
You can’t perform that action at this time.
0 commit comments