Permalink
Browse files

catch Error, because socket of null sometimes take an Error

  • Loading branch information...
1 parent 61e4105 commit 54da4e862683db927b8f3c100669f803f12a3178 @justoneplanet justoneplanet committed Nov 27, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/WebSocketRequest.js
View
8 lib/WebSocketRequest.js
@@ -377,8 +377,12 @@ WebSocketRequest.prototype.accept = function(acceptedProtocol, allowedOrigin, co
// }
response += "\r\n";
-
- if (this.socket != null) this.socket.write(response, 'ascii');
+ try {
+ if (this.socket != null) this.socket.write(response, 'ascii');
+ }
+ catch(e) {
+ console.log('justoneplanet-' + e);
+ }
this.emit('requestAccepted', connection);

0 comments on commit 54da4e8

Please sign in to comment.