Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#1904. Don't crash if a write to a client fails, which can happen som…

…etimes when a client has left but some data is still buffered.
  • Loading branch information...
commit 15ff38cba6afe5ebe36302fae10bded3bc6f9cc7 1 parent 3b0e6b8
@orospakr authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/mmsh-client-session.js
View
6 lib/mmsh-client-session.js
@@ -58,7 +58,11 @@ module.exports.MMSHClientSession = function(stream, verifyIsIDUnique) {
response.write(header_bin);
this.data_handler = function(data_packet, repacked_data) {
log.debug(c, this.client_id + ": sending data packet to attached client...");
- response.write(repacked_data);
+ try {
+ response.write(repacked_data);
+ } catch(e) {
+ // client disconnected, otherwise unavailable. happens sometimes when clients disconnected and there's some buffering going on.
+ }
}.bind(this);
stream.on("Data", this.data_handler);
req.socket.once("close", function(if_error) {
Please sign in to comment.
Something went wrong with that request. Please try again.