Permalink
Browse files

Fix issue #62. The problem is that in assert.response, server.fd is u…

…sed to check if the server is listening. However, in net.js you can see that server.fd is set when the socket is created and not yet listening. I changed it to use a __listening flag instead.
  • Loading branch information...
1 parent 2c8759f commit 5c0a1a707c10f81ec3318c77d46752aa45220ef0 @andrewjstone andrewjstone committed with tj Feb 17, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 bin/expresso
View
@@ -340,13 +340,14 @@ assert.length = function(val, n, msg) {
assert.response = function(server, req, res, msg){
// Check that the server is ready or defer
- if (!server.fd) {
+ if (!server.__listening) {
if (!('__deferred' in server)) {
server.__deferred = [];
}
server.__deferred.push(arguments);
if (!server.__started) {
server.listen(server.__port = port++, '127.0.0.1', function(){
+ server.__listening = true;
if (server.__deferred) {
process.nextTick(function(){
server.__deferred.forEach(function(args){

0 comments on commit 5c0a1a7

Please sign in to comment.