Skip to content

Commit

Permalink
Fix a bug in close detection.
Browse files Browse the repository at this point in the history
The connection._socket is connection.socket for websocket (draft-10).
  • Loading branch information
mbostock committed Oct 3, 2011
1 parent 143b0cb commit eaacccc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/cube/server/server.js
Expand Up @@ -52,7 +52,8 @@ module.exports = function(options) {

// Register secondary WebSocket listener.
secondary.on("connection", function(connection) {
connection.remoteAddress = connection._socket.remoteAddress;
connection.socket = connection._socket;
connection.remoteAddress = connection.socket.remoteAddress;
connection.sendUTF = connection.send;
connect(connection, connection._req);
});
Expand Down Expand Up @@ -82,7 +83,7 @@ module.exports = function(options) {
// closed very shortly after it is opened. So we do an additional
// check using an interval to verify that the socket is still open.
var interval = setInterval(function() {
if (!connection._socket.writable) {
if (!connection.socket.writable) {
interval = clearInterval(interval);
connection.close();
}
Expand Down

0 comments on commit eaacccc

Please sign in to comment.