Commit Graph

883 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
40202a00b7 BREAKING: change how the filter function works
It's non-standard for a callback function to take a non-error argument
in the first position.

So instead of the filter callback accepting three types of arguments:

cb(true) // allowed
cb(false) // disallowed
cb(new Error('custom message')) // disallowed with custom message

It now accepts two forms:

cb(new Error('custom message')) // disallowed with custom message
cb(null) // allowed
2017-03-01 22:54:40 -08:00
Feross Aboukhadijeh
eef8bdd326 8.6.1 2017-03-01 22:33:51 -08:00
Feross Aboukhadijeh
6fdb3067e2 simple-peer@7 2017-03-01 22:33:35 -08:00
Feross Aboukhadijeh
0951f21a95 8.6.0 2017-03-01 22:30:00 -08:00
Feross Aboukhadijeh
3b17130092 Merge pull request #211 from feross/deps
Update dependencies
2017-03-01 22:28:34 -08:00
Feross Aboukhadijeh
3c7a637efd ws@2 2017-03-01 22:27:56 -08:00
Feross Aboukhadijeh
de5578a565 simple-websocket@5 2017-03-01 22:27:49 -08:00
Feross Aboukhadijeh
28b6384fda 8.5.2 2017-02-28 15:45:29 -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
Feross Aboukhadijeh
78722e0a05 8.5.1 2017-02-28 15:31:53 -08:00
Feross Aboukhadijeh
7652e7465c Merge pull request #208 from feross/fix-205
Fix socket.infoHashes access error
2017-02-28 15:31:05 -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
ccb50a7ee9 add one missing self.destroyed check 2017-02-21 01:51:08 -08: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
40707a1605 8.5.0 2017-02-13 17:39:46 -08:00
Feross Aboukhadijeh
5375506f56 Merge pull request #202 from feross/unordered-array-remove
Use unordered-array-remove for better performance!
2017-02-13 17:38:03 -08:00
Feross Aboukhadijeh
7d2318dce6 Use unordered-array-remove for better performance! 2017-02-13 17:30:22 -08:00
Feross Aboukhadijeh
9f88f46c76 8.4.0 2017-02-09 14:16:53 -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
da7d7323df 8.3.1 2017-02-09 14:14:10 -08:00
Feross Aboukhadijeh
b3103181fa Merge pull request #201 from feross/disable-clientTracking
Disable ws server clientTracking
2017-02-09 23:13:14 +01:00
Feross Aboukhadijeh
3d81e68124 standard 2017-02-08 16:22:13 -08:00
Diego Rodríguez Baquero
7fea1964af Update server.js 2017-02-08 16:53:50 -05:00
Diego Rodríguez Baquero
a1ee19d59a Set ws server clientTracking to false
https://github.com/feross/bittorrent-tracker/pull/200#issuecomment-278450630
2017-02-08 16:47:54 -05: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
cd4a976121 add failing tests for desired evicition behavior 2017-02-08 13:12:39 -08:00
Feross Aboukhadijeh
4422067607 test: server: check that all clients, server are destroyed 2017-02-08 13:11:48 -08:00
Feross Aboukhadijeh
e731106279 test: ensure electron-webrtc is started only for test where it's needed
before this change, it was getting initialized immediately, since it
was outside a tape test block
2017-02-08 13:11:35 -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
6351f2b260 style: re-order methods 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
Feross Aboukhadijeh
ed3da2f39b If peer is already complete, it should still be refreshed in the LRU cache 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
c2c8e36af7 Fix bug where left = 0 would be converted to Infinity
Possibly fixes: https://github.com/feross/bittorrent-tracker/issues/196
2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
27ae148167 Fixes for PR #185 2017-02-08 12:27:50 -08:00
Feross Aboukhadijeh
76165007ba 8.3.0 2017-02-08 10:56:31 -08:00
Diego Rodríguez Baquero
4c86e98e44 Merge pull request #200 from feross/disable-deflate
perf: disable perMessageDeflate
2017-02-08 11:04:10 -05:00
Feross Aboukhadijeh
71bd413980 perf: disable perMessageDeflate
From the ws docs:

"ws supports the permessage-deflate extension extension which enables
the client and server to negotiate a compression algorithm and its
parameters, and then selectively apply it to the data payloads of each
WebSocket message.

The extension is enabled by default but adds a significant overhead in
terms of performance and memory comsumption. We suggest to use
WebSocket compression only if it is really needed.

To disable the extension you can set the perMessageDeflate option to
false"
2017-02-07 23:00:10 -08:00
Feross Aboukhadijeh
9d5b55b498 Merge pull request #197 from feross/fewer-offers
ws client: Don't include offers with 'completed' event
2017-02-03 23:46:20 +01:00
Feross Aboukhadijeh
30b6f176b1 ws client: Don't include offers with 'completed' event
It's not necessary to include webrtc offers because the client is not
really looking for more peers when it has just completed the torrent.

Fewer WebRTC offers = less resource usage
2017-02-02 16:59:36 -08:00
Feross Aboukhadijeh
fb751d7c96 Re-enable ws server tests (websocket tracker) 2017-01-29 16:25:16 -08:00
Feross Aboukhadijeh
2cb749d739 minor style 2017-01-29 15:37:22 -08:00
Feross Aboukhadijeh
0f57bfcd28 8.2.0 2017-01-23 15:00:31 -08:00
Feross Aboukhadijeh
3b463e4dbf Merge pull request #194 from feross/final-wait
Wait up to 1s for pending requests before destroy()
2017-01-23 14:59:19 -08:00