Skip to content

Commit

Permalink
change detach to defer
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed Oct 15, 2014
1 parent 45ac376 commit a1d3700
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var extend = require('util')._extend
, jsonSafeStringify = require('json-stringify-safe')
, crypto = require('crypto')

function detachMethod() {
function deferMethod() {
if(typeof setImmediate === 'undefined') {
return process.nextTick
}
Expand Down Expand Up @@ -86,4 +86,4 @@ exports.safeStringify = safeStringify
exports.md5 = md5
exports.isReadStream = isReadStream
exports.toBase64 = toBase64
exports.detach = detachMethod()
exports.defer = deferMethod()
6 changes: 3 additions & 3 deletions request.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var optional = require('./lib/optional')
, md5 = helpers.md5
, isReadStream = helpers.isReadStream
, toBase64 = helpers.toBase64
, detach = helpers.detach
, defer = helpers.defer
, bl = require('bl')
, oauth = optional('oauth-sign')
, hawk = optional('hawk')
Expand Down Expand Up @@ -655,7 +655,7 @@ Request.prototype.init = function (options) {
// })
})

detach(function () {
defer(function () {
if (self._aborted) {
return
}
Expand Down Expand Up @@ -762,7 +762,7 @@ Request.prototype.init = function (options) {
}

function wait_for_socket_response(){
detach(function(){
defer(function(){
// counter to prevent infinite blocking waiting for an open socket to be found.
response_counter++
var trying = false
Expand Down

0 comments on commit a1d3700

Please sign in to comment.