Permalink
Browse files

Fixed issue with destroying request on timeout

  • Loading branch information...
1 parent 3715269 commit d1da4a3cb490e29912754bc91e9812da28127bae @chriso chriso committed Nov 24, 2010
Showing with 17 additions and 7 deletions.
  1. +2 −2 HISTORY.md
  2. +1 −1 lib/node.io/index.js
  3. +14 −4 lib/node.io/request.js
View
@@ -1,7 +1,7 @@
-## v0.1.1-16
+## v0.1.1-17
* Fixed incorrect handling of large streams
* Better support for request timeouts
- * Bug fixes
+ * Bug fixes
### v0.1.1-6
* Added a debug switch -g
@@ -9,7 +9,7 @@ var processor = require('./processor'),
job = require('./job');
exports = module.exports = {
- version: '0.1.1-16',
+ version: '0.1.1-17',
Processor: processor.Processor,
JobProto: job.JobProto, //A reference to the underlying Job.prototype
JobClass: job.JobClass, //A reference to a new prototype identical to Job.prototype (so Job.prototype isn't modified)
@@ -96,10 +96,20 @@ Job.prototype.doRequest = function (method, resource, body, headers, callback, p
//This method is called on each event if the instance is already complete (i.e. timed out)
var cleanup = function () {
- //Which is it? :s
- request.socket.destroy();
- request.destroy();
- host.destroy();
+
+ //I'll clean up this mess once I figure out which destroy() to call (API is unclear with 0.2.4 => 0.3.1)
+ if (request) {
+ if (request.socket && request.socket.destroy) {
+ request.socket.destroy();
+ }
+ if (request.destroy) {
+ request.destroy();
+ }
+ }
+ if (host.destroy) {
+ host.destroy();
+ }
+
};
//Watch for errors

0 comments on commit d1da4a3

Please sign in to comment.