Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dont close readstream fd if its already closed

  • Loading branch information...
commit 6e63532fda6833174895c5f1f81349e71995a031 1 parent 2b54e66
@mhansen authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/antinode.js
View
10 lib/antinode.js
@@ -11,7 +11,7 @@ var http = require('http'),
exports.default_settings = {
"timeout_milliseconds": 1000 * 30,
"hosts" : {},
- "port" : 8080,
+ "port" : 8080, /* a port that you don't need root to bind to */
"default_host" : {
"root" : process.cwd()
},
@@ -22,6 +22,7 @@ exports.log_levels = log.levels;
var settings;
var server;
+
exports.start = function(custom_settings, callback) {
settings = custom_settings || {};
settings.__proto__ = exports.default_settings;
@@ -142,8 +143,11 @@ function handle_request(path, req, resp) {
send_headers(200, stats.size, mime.mime_type(file), stats.mtime);
req.connection.addListener('timeout', function() {
- log.debug('timed out. destroying file read stream');
- readStream.destroy();
+ /* dont destroy it when the fd's already closed */
+ if (readStream.fd) {
+ log.debug('timed out. destroying file read stream');
+ readStream.destroy();
+ }
});
readStream.addListener('open', function() {
Please sign in to comment.
Something went wrong with that request. Please try again.