From 73c941c6eb3b539efbbbb499ab3d033531347b19 Mon Sep 17 00:00:00 2001 From: Julen Garcia Leunda Date: Thu, 17 Jun 2021 06:15:49 +0200 Subject: fix: make utp-native optional (#1966) * Add optional utp-native * Add error log when uTP cannot be loaded * Fix review suggestions * Remove an additional require call Co-authored-by: Alex --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'index.js') diff --git a/index.js b/index.js index 692fe27..f92576a 100644 --- a/index.js +++ b/index.js @@ -74,7 +74,7 @@ class WebTorrent extends EventEmitter { this.lsd = opts.lsd !== false this.torrents = [] this.maxConns = Number(opts.maxConns) || 55 - this.utp = opts.utp === true + this.utp = WebTorrent.UTP_SUPPORT && opts.utp === true this._debug( 'new webtorrent (peerId %s, nodeId %s, port %s)', @@ -429,6 +429,7 @@ class WebTorrent extends EventEmitter { } WebTorrent.WEBRTC_SUPPORT = Peer.WEBRTC_SUPPORT +WebTorrent.UTP_SUPPORT = ConnPool.UTP_SUPPORT WebTorrent.VERSION = VERSION /** -- cgit v1.2.3