File tree 3 files changed +46
-2
lines changed
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() {
1185
1185
parser . incoming = null ;
1186
1186
1187
1187
socket . on ( 'error' , function ( err ) {
1188
- debug ( 'AGENT SOCKET ERROR: ' + err . message ) ;
1188
+ debug ( 'AGENT SOCKET ERROR: ' + err . message + '\n' + err . stack ) ;
1189
1189
var req ;
1190
1190
if ( socket . _httpMessage ) {
1191
1191
req = socket . _httpMessage ;
Original file line number Diff line number Diff line change @@ -844,7 +844,12 @@ Socket.prototype._shutdown = function() {
844
844
try {
845
845
this . _shutdownImpl ( ) ;
846
846
} catch ( e ) {
847
- this . destroy ( e ) ;
847
+ if ( e . code == 'ENOTCONN' ) {
848
+ // Allowed.
849
+ this . destroy ( ) ;
850
+ } else {
851
+ this . destroy ( e ) ;
852
+ }
848
853
}
849
854
} else {
850
855
// 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