Skip to content

Commit

Permalink
check for valid fd before sendfile()ing
Browse files Browse the repository at this point in the history
  • Loading branch information
mhansen committed Jun 20, 2010
1 parent e5c4294 commit 51e31dc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/antinode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 51e31dc

Please sign in to comment.