From 70dd6d4ea369ccbfd6e573d9a42b5144dc23b4b3 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 20 May 2011 15:39:48 -0700 Subject: [PATCH] Fix TJ's assert error Unable to reproduce but connect's "make test TESTS=test/static.test.js" does it occasionally. --- lib/http.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/http.js b/lib/http.js index d7c0083..a8602fd 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1089,7 +1089,11 @@ function connectionListener(socket) { // When we're finished writing the response, check if this is the last // respose, if so destroy the socket. res.on('finish', function() { - assert(incoming[0] === req); + // Usually the first incoming element should be our request. it may + // be that in the case abortIncoming() was called that the incoming + // array will be empty. + assert(incoming.length == 0 || incoming[0] === req); + incoming.shift(); res.detachSocket(socket); -- 2.7.4