Commit Graph

148 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
fc87c8c9ff build 2018-02-17 17:13:56 -08:00
Feross Aboukhadijeh
8c28f025b4 Fixes for ws@3 2017-06-23 15:51:27 -07:00
Feross Aboukhadijeh
992cd77fc7 expose Swarm object for easy overriding 2017-03-10 13:38:43 -08:00
Feross Aboukhadijeh
ee9ebc506c remove requestHandler option 2017-03-10 13:38:27 -08:00
Yoann Ciabaud
146d4d46dd Extension point on requests and responses 2017-03-09 11:19:46 +01:00
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
ccb50a7ee9 add one missing self.destroyed check 2017-02-21 01:51:08 -08:00
Feross Aboukhadijeh
b2c2b8f0d0 do not access socket.infoHashes if socket is destroyed 2017-02-21 01:50:30 -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
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
d534582a8c Only close websocket when it's not participating in any more swarms 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
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
fb751d7c96 Re-enable ws server tests (websocket tracker) 2017-01-29 16:25:16 -08:00
Feross Aboukhadijeh
9cf2dffa67 debug: better debug names 2017-01-20 18:34:33 -08:00
Feross Aboukhadijeh
f2786cde96 Fixes for PR #170 2016-08-09 21:39:30 -07:00
Alex
ebf117242c Check if peer is undefined 2016-08-09 13:30:40 +02:00
Yoann Ciabaud
f76b27c12a Merge pull request #160 from yciabaud/lru-pruning
Limit peers in tracker server with LRU based cache fixes #4
2016-07-19 19:50:25 +02:00
Yoann Ciabaud
2ac65725a1 Merge pull request #158 from yciabaud/stats-clients
Add stats on clients based on peerIds
2016-06-23 15:08:23 +02:00
Yoann Ciabaud
29fcf30cb4 Use correct HTTP header to work with JSON on GET 2016-06-13 00:34:26 +02:00
Yoann Ciabaud
d51a77b028 Update lru package to 3.0.0 and set peersCacheLength to 1K as default 2016-06-10 10:00:19 +02:00
Yoann Ciabaud
ca522c0c4b Prune old peers in server with lru based cache. Issue #4 2016-06-08 23:57:01 +02:00
Yoann Ciabaud
f8c7de5213 Add stats on clients based on peerIds 2016-06-07 14:34:38 +02:00
Yoann Ciabaud
d7a651f360 Fixes for PR #155 2016-06-07 10:49:27 +02:00
jakefb
7906848037 Add json to tracker stats 2016-06-02 14:27:14 +12:00
Feross Aboukhadijeh
2959c2cea6 Use safe-buffer
Use the new Buffer APIs from Node v6 for added security. For example,
`Buffer.from()` will throw if passed a number, unlike `Buffer()` which
allocated UNINITIALIZED memory in that case.

Use the `safe-buffer` package for compatibility with previous versions
of
Node.js, including v4.x, v0.12, and v0.10.

https://github.com/feross/safe-buffer
2016-05-29 23:12:23 -07:00
Feross Aboukhadijeh
fafbb25367 Fix "Error: listener must be a function"
The websocket can error and close before the "connection" event has
fired. In that situation, socket.onMessageBound, etc. will be undefined.

Closes #148
2016-04-22 16:34:41 -07:00
Feross Aboukhadijeh
3cd84411fb Fixes for PR #142 2016-03-30 00:31:51 -07:00
Diego Rodríguez
035994ccea Web-based tracker statistics 2016-03-29 19:03:24 -03:00
Feross Aboukhadijeh
c92b1714db Remove all Function.bind calls
For https://github.com/feross/webtorrent-desktop/issues/256
2016-03-28 23:38:23 -07:00
Feross Aboukhadijeh
721a7bea7c make server and client always send { action: 'announce' } 2016-03-23 22:04:07 -07:00
Feross Aboukhadijeh
14ef5dc4b0 ensure that params.offers is type Array 2016-03-18 22:49:13 -07:00
Feross Aboukhadijeh
efb81c29cc fix: cleanup websocket connections
Removed by accident here:
https://github.com/feross/bittorrent-tracker/commit/d079171044e0c1f84f9e
431b110358ad1ff2b20f#diff-78c12f5adc1848d13b1c6f07055d996eL602
2016-03-18 22:48:59 -07:00
Feross Aboukhadijeh
4902a99260 ws server: ignore all future socket errors after socket close 2016-03-18 22:35:01 -07:00
Feross Aboukhadijeh
5020b538ce fix: announces only have one info_hash 2016-03-18 15:57:18 -07:00
Feross Aboukhadijeh
36a4c2208a null out bound functions 2016-03-18 15:55:12 -07:00
Feross Aboukhadijeh
bd92a827e1 fix: reference error 2016-03-18 15:55:07 -07:00
Feross Aboukhadijeh
0740f92d7c server: more thorough socket cleanup 2016-03-18 15:06:05 -07:00
Feross Aboukhadijeh
5ee3f22e2b Fixes for PR #134 2016-03-18 15:02:12 -07:00
Diego Rodríguez Baquero
5138d5c5a9 Standard fix 2016-03-17 16:52:48 -03:00
Diego Rodríguez Baquero
f70d0d2f07 Fix #113 2016-03-17 16:49:27 -03:00
Feross Aboukhadijeh
d079171044 Fixes for PR #129 2016-03-16 17:58:47 -07:00
Yoann Ciabaud
35e6eeaef2 Close the websocket only when no one is using it 2016-03-16 17:33:06 -07:00
Feross Aboukhadijeh
7a7ed575e1 check for params.offers to determine if offers were received 2016-03-15 20:06:53 -07:00
Feross Aboukhadijeh
ba4a52d2d1 Fixes for PR #125 2016-03-15 20:06:39 -07:00
Yoann Ciabaud
39507bf8be Scrape implementation for websocket. Issue #116 2016-03-14 00:36:51 +01:00
Yoann Ciabaud
60f03b9529 Provide IP and HTTP headers in both HTTP and Websocket server 2016-03-03 11:10:54 +01:00
Alex
4142e8cf20 Remove info_hash from failure reason 2016-03-01 19:22:31 +01:00
Feross Aboukhadijeh
5dcdf9c4c1 ws tracker: don't crash with filter function 2016-02-29 17:35:04 -08:00