Skip to content

Commit 660e067

Browse files
committed
trap errors coming from nodejs tcp ocket read handlers so they will not crash the whole freedomjs module
1 parent bb03368 commit 660e067

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cloud/social/shim/tcp.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ FreedomTCP.prototype._onRead = function(readInfo) {
2525
//console.warn('read ' + len +': ' + str);
2626

2727
if (this.reading) {
28-
this.onread(len, buf);
28+
try {
29+
this.onread(len, buf);
30+
} catch (e) {
31+
console.error('nodejs socket read handler raised en error', e);
32+
}
2933
} else {
3034
this.bufferedReads.push({buf: buf, len: len});
3135
}

0 commit comments

Comments
 (0)