Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Close the connection more reliably

  • Loading branch information...
commit f74af1345334d4bbf90213d768714ad6aeb1aa4f 1 parent 9c049da
@jhs jhs authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib.js
View
10 lib.js
@@ -88,12 +88,14 @@ exports.req_json = function req_json(opts, callback) {
var timeout_er = new Error('Request timeout (' + (duration/1000).toFixed(1) + 's): ' + opts.uri);
timeout_er.timeout = duration;
- //if(in_flight && in_flight.destroy)
- // in_flight.destroy()
//if(in_flight && in_flight.response && in_flight.response.abort)
// in_flight.response.abort()
- if(in_flight && in_flight.response.connection)
- in_flight.response.connection.destroy()
+ //if(in_flight && in_flight.response.connection)
+ // in_flight.response.connection.destroy()
+ if(in_flight && in_flight.req && in_flight.req.connection && in_flight.req.connection.destroy)
+ in_flight.req.connection.destroy()
+ if(in_flight && in_flight.destroy)
+ in_flight.destroy()
callback(timeout_er);
}
Please sign in to comment.
Something went wrong with that request. Please try again.