Permalink
Browse files

Rollback previous change and fix another way

  • Loading branch information...
1 parent 7c66bba commit 5aa731f207e4840606d90b7ac18b67eaac5439d1 @rs committed Jan 20, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/worker.js
View
@@ -62,7 +62,8 @@ function Worker(options)
res.writeHead(200, {'Content-Type': 'application/xml'});
return res.end(policyFile);
}
- else if (req.headers.accept && req.headers.accept.indexOf('text/event-stream') != -1 && (pathInfo = pathname.match(path2ns)))
+ // Test res.socket as sometime, for unknown reason, there is no assigned socket and this lead to crashes
+ else if (res.socket && req.headers.accept && req.headers.accept.indexOf('text/event-stream') != -1 && (pathInfo = pathname.match(path2ns)))
{
res.writeHead(200,
{
@@ -104,7 +105,7 @@ Worker.prototype.join = function(namespace, client)
// Increment namespace counter on master
process.send({cmd: 'join', namespace: namespace});
// Decrement on exit
- client.on('close', function()
+ client.socket.on('close', function()
{
process.send({cmd: 'leave', namespace: namespace});
});

0 comments on commit 5aa731f

Please sign in to comment.