Skip to content

Commit

Permalink
check that socket is writable in handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzadebate committed Jun 19, 2012
1 parent d3629c9 commit 40321a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/WebSocketServer.js
Expand Up @@ -198,7 +198,8 @@ function handleHixieUpgrade(req, socket, upgradeHead, cb) {
if (typeof origin != 'undefined') {
headers.push('Sec-WebSocket-Origin: ' + origin);
}


if (!socket.writable) return;
socket.setTimeout(60 * 60 * 1000);
socket.setNoDelay(true);
try {
Expand Down Expand Up @@ -290,7 +291,8 @@ function handleHybiUpgrade(req, socket, upgradeHead, cb) {
} catch(_) {}
return false;
}


if (!socket.writable) return;
socket.setTimeout(60 * 60 * 1000);
socket.setNoDelay(true);
var client = new WebSocket([req, socket, upgradeHead], {
Expand Down

0 comments on commit 40321a7

Please sign in to comment.