Commit Graph

208 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
dd02cddcb8 ensure that 'peer' is emitted before 'connect' event fires
This is just a defensive code change to ensure that if signal() were somehow able to cause the peer to synchronously emit the 'connect' event that we won't cause the 'error' listener to be unregistered before 'peer' is emitted and the user has a chance to register their own 'error' listener
2021-04-12 16:13:35 -07:00
Feross Aboukhadijeh
ce8ea41f27 Lower the max number of WebRTC peers in an announce to 5 2021-04-12 15:54:01 -07:00
Feross Aboukhadijeh
2a828292b8 standard 2020-10-29 10:25:57 -10:00
Feross Aboukhadijeh
c88bbb4a62 standard 2020-10-28 18:57:47 -10:00
Feross Aboukhadijeh
eb69f8d7ab standard 2020-10-21 13:47:38 -10:00
Diego Rodríguez Baquero
51db46f4b2
increase reconnect variance and maximum 2020-03-29 13:34:50 -05:00
Diego Rodríguez Baquero
e5df6fc2fc
fix: error param 2020-03-29 12:22:44 -05:00
Koushik Dutta
29d2e6b1b3
Error.message is read only on some platforms.
This causes another Error to be thrown.
2020-02-03 15:52:37 -08:00
Feross Aboukhadijeh
4196c26917
Merge pull request #332 from guanzo/bugfix
Check if socket is already connected in _openSocket().
2019-08-18 12:52:51 -07:00
Eric Guan
fc2f84ad60 Check if socket is already connected in _openSocket(). Fixes https://github.com/webtorrent/webtorrent/issues/1245. 2019-08-14 14:20:18 -07:00
Feross Aboukhadijeh
695ade5b86 Remove useless assignment 2019-08-12 18:20:45 -07:00
Feross Aboukhadijeh
ddee6b96b5 Fix URL constructor on udp:// urls in Chrome App environment
For: https://github.com/brave/brave-browser/issues/5604

`bittorrent-tracker` is broken when run in a Chrome App environment.

The issue is that the `URL` constructor is buggy Chromium. https://bugs.chromium.org/p/chromium/issues/detail?id=734880

We switched to `URL` from `require('url')` in `bittorrent-tracker@9.13.0`. Commit: 93b41391a9

This code path was not exercised by `bittorrent-tracker`'s tests because UDP trackers are normally only used in a Node.js environment. Braves run the code in a Chrome extension environment which we don't test.
2019-08-08 20:04:41 -07:00
Feross Aboukhadijeh
d6751dac41 remove safe-buffer 2019-08-06 17:58:05 -07:00
Feross Aboukhadijeh
93b41391a9 BREAKING: drop Node 8 support 2019-08-05 14:54:20 -07:00
Feross Aboukhadijeh
1a075bd159 standard 2019-07-05 14:36:14 -07:00
Feross Aboukhadijeh
85e7a606a6 standard 2019-07-04 21:58:13 -07:00
Diego Rodríguez Baquero
dd861404e2
Leave default case without brackets 2018-12-20 15:03:15 -05:00
Justin Kalland
dc79834f77 Use blocks with brackets 2018-12-20 12:59:53 -07:00
Justin Kalland
bc861ef10a Revert "Remove declarations from inside switch statements"
This reverts commit d1b9047c03.
2018-12-20 12:52:05 -07:00
Justin Kalland
d1b9047c03 Remove declarations from inside switch statements 2018-12-20 12:36:54 -07:00
Diego Rodríguez Baquero
d410c6c088
Merge branch 'master' into modernize_lib_client 2018-11-22 11:00:48 -05:00
Diego Rodríguez Baquero
f7d3e9b7c0
Lower reconnect min and increase variance
This will allow servers to "breathe" when lots of peers are reconnecting.
2018-11-22 10:59:34 -05:00
Jimmy Wärting
c8ceaee306 replace self with this 2018-10-03 15:06:38 +02:00
Jimmy Wärting
386e0a5fbe lebab lib/client 2018-10-03 14:44:11 +02:00
Jimmy Wärting
65b2bdc804 removed xtend 2018-10-02 15:09:02 +02:00
John Hiesey
7ac0e9539a Expose WebSocketTracker socket pool
This is necessary for the Internet Archive superpeer implementation.
2018-08-09 15:28:13 -07:00
Feross Aboukhadijeh
fc87c8c9ff build 2018-02-17 17:13:56 -08:00
Feross Aboukhadijeh
63c953cbea dry some code 2017-04-07 18:24:16 -07:00
Feross Aboukhadijeh
48d0ea42ad Handle peer 'error' events correctly
Handle peer 'error' events that are fired *before* the peer is emitted
in a 'peer' event. Once the peer is emitted in a 'peer' event, then
it's the consumer's responsibility to listen for errors.

This fixes the most common error in WebTorrent Desktop according to our
telemetry.
2017-04-07 17:34:08 -07:00
Feross Aboukhadijeh
f65983e466 do not filter out extra keys from 'update' events 2017-03-10 13:38:04 -08:00
Yoann Ciabaud
8482c3af0a Add extra data on ws annouce event 2017-03-09 11:19:46 +01:00
Feross Aboukhadijeh
173161cc47 Merge pull request #209 from GusCaplan/patch-1
Update common-node.js
2017-03-08 02:12:07 -08:00
Feross Aboukhadijeh
714400abae use correct API signature in querystring methods 2017-03-08 02:07:48 -08:00
Feross Aboukhadijeh
a09158bb4b Delete socket.upgradeReq when it is no longer needed to reduce memory usage
cc @lpinca
2017-03-07 13:22:51 -08:00
Feross Aboukhadijeh
1dd1cc32da Revert "client: socketPool should not be shared across clients"
This reverts commit 3f3db7deb1.
2017-02-28 15:41:52 -08:00
Gus Caplan
e771c0f57e Update common-node.js 2017-02-21 17:16:18 -06:00
Gus Caplan
9962d31e69 Update common-node.js
i was just reading the source and noticed this, if there is some reason it won't work please let me know
2017-02-21 17:07:03 -06:00
Feross Aboukhadijeh
fe11c695cb do not close socket even when it's not in other swarms 2017-02-21 01:50:48 -08:00
Feross Aboukhadijeh
b2c2b8f0d0 do not access socket.infoHashes if socket is destroyed 2017-02-21 01:50:30 -08:00
Feross Aboukhadijeh
7d2318dce6 Use unordered-array-remove for better performance! 2017-02-13 17:30:22 -08:00
Feross Aboukhadijeh
a469740603 Merge pull request #198 from feross/fix-196
Fix stats and leaked websockets
2017-02-09 23:16:28 +01:00
Feross Aboukhadijeh
3d81e68124 standard 2017-02-08 16:22:13 -08:00
Feross Aboukhadijeh
3f3db7deb1 client: socketPool should not be shared across clients
Caught this issue because of the new eviction tests. Essentially, this
change moves the socketPool into the client instance instead of a
reused variable at the module level.

When a client sends stop (or is evicted) the server will close the
websocket connection if that client is not in any other swarms (based
on peerId). However, if we are using a single socket for multiple
clients (as was the case before this commit), then other clients will
have their sockets unintentionally closed by the server.
2017-02-08 13:20:41 -08:00
Feross Aboukhadijeh
806ce1d18b Address @DiegoRBaquero's feedback
From comment:
https://github.com/feross/bittorrent-tracker/pull/198#discussion_r993882
95
2017-02-08 13:13:20 -08:00
Feross Aboukhadijeh
d534582a8c Only close websocket when it's not participating in any more swarms 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
29d4564bbd remove unneeded timeout 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
1b22b53fe8 fix tests: wait for socket to send final responses 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
7075088848 Close websockets when peers are evicted from LRU cache
Possibly fixes: https://github.com/feross/bittorrent-tracker/issues/196

Close websockets when peers are evicted from LRU cache, otherwise it's
possible for a peer object to be evicted from the LRU cache without the
socket being cleaned up. That will leak memory until the websocket is
closed by the remote client. It also messes up the stats.
2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
8f33b95f9f swarm maxAge: increase to 20 min 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
62dd0f7df2 treat unexpected 'completed' events as 'updated' 2017-02-08 12:27:50 -08:00