Skip to content

Commit

Permalink
Work around nodejs bug with 'onread' handler
Browse files Browse the repository at this point in the history
  • Loading branch information
animetosho committed Dec 23, 2020
1 parent 3566234 commit 7a25aa7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/nntp.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ function NNTP(opts) {
this._connectRetries = opts.connectRetries;

var connectOpts = opts.connect;
var supportsOnread = /^v(12\.1\d|1[3-9]|[2-9]\d|\d\d\d)\./.test(process.version); // test if node >= 12.10.0
// although the feature was added in node 12.10.0, it's crashy on Linux until 13.13.0 / 12.16.3
var supportsOnread = (
+process.version.replace(/\.\d+$/, '').replace(/^v/, '') >= 13.13
|| /^v12\.(16\.[3-9]|1[789]\.|[2-9]\d\.)/.test(process.version)
);
if(supportsOnread || !opts.connect.port) {
connectOpts = util.extend({}, opts.connect);
this.opts = util.extend({}, this.opts, {connect: connectOpts});
Expand Down

0 comments on commit 7a25aa7

Please sign in to comment.