Browse files

check for valid fd before sendfile()ing

  • Loading branch information...
1 parent e5c4294 commit 51e31dc4ee5e19738816bad4fa0e9661a7d0ce10 @mhansen committed Jun 20, 2010
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/antinode.js
View
1 lib/antinode.js
@@ -162,6 +162,7 @@ function handle_request(path, req, resp) {
// control so we need to keep sending till the whole file's sent.
function send_chunk(offset, bytes_to_write, callback) {
log.debug('sending chunk of', file, offset, bytes_to_write);
+ if (!req.connection.fd) return callback(); //the connection timed out
fs.sendfile(req.connection.fd, fd, offset, bytes_to_write,
function (err, bytes_written) {
if (err) {

0 comments on commit 51e31dc

Please sign in to comment.