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
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
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
2cb749d739
minor style
2017-01-29 15:37:22 -08:00
Feross Aboukhadijeh
0aadcc1cbb
Wait up to 1s for pending requests before destroy()
...
If the user calls:
client.stop()
client.destroy()
We should ensure that the final 'stopped' message reaches the tracker
server, even though the client will not get the response (because they
destroyed the client and no more events will be emitted).
If there are pending requests when destroy() is called, then a 1s timer
is set after which point all requests are forcibly cleaned up. If the
requests complete before the 1s timer fires, then cleanup happens right
away (so we're not stuck waiting for the 1s timer).
So, destroy() can happen one of three ways:
- immediately, if no pending requests exist
- after exactly 1s, if pending requests exist and they don't complete
within 1s
- less than 1s, if pending requests exist and they all complete before
the 1s timer fires
2017-01-20 18:41:28 -08:00
Feross Aboukhadijeh
9cf2dffa67
debug: better debug names
2017-01-20 18:34:33 -08:00
Feross Aboukhadijeh
c4f4f012dd
Add fixes and tests for PR #179
2017-01-16 15:43:47 -08:00
Feross Aboukhadijeh
91cb2d3439
Merge pull request #179 from zunsthy/feature-add-user-agent
...
add 'user-agent' in HTTP header
2017-01-16 15:20:11 -08:00
Sidd Sridharan
9d9893a0f2
parse params.left = 0 properly
2016-12-04 12:42:57 -08:00
Feross Aboukhadijeh
3a0fec0701
standard fixes
2016-11-22 19:52:01 -03:00
ZunSThy
bd8bc9f6af
add 'user-agent' in HTTP header
2016-11-06 16:00:08 +08:00
ZunSThy
e0ede27049
Revert "add 'user-agent' in HTTP header"
...
This reverts commit 725527aa84
.
2016-11-06 15:59:04 +08:00
ZunSThy
7ae7a2ca07
Revert "fix eslint"
...
This reverts commit 0444e937e2
.
2016-11-06 15:58:52 +08:00
ZunSThy
0444e937e2
fix eslint
2016-10-29 04:25:50 +08:00
ZunSThy
725527aa84
add 'user-agent' in HTTP header
2016-10-29 02:51:37 +08:00
Feross Aboukhadijeh
b2cbfafae7
use 'once' on some event handlers
2016-09-16 07:49:29 -07:00
Feross Aboukhadijeh
a35f1f8178
replace hat with randombytes
2016-08-20 19:37:36 -07:00
Alex
f14d0b83df
Add id parameter in announce calls
2016-08-08 17:25:25 +02:00
Yoann Ciabaud
2c7ea4e307
Refactor id usage in announce and fix default peersCacheTtl
2016-06-14 07:15:57 +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
5843b7d2f6
Bugfix in manual peer eviction.
2016-06-10 00:29:56 +02:00
Yoann Ciabaud
7f98203d5e
Manually clean peers on announce
2016-06-09 16:28:31 +02:00
Yoann Ciabaud
5dcc932247
Refresh cache on changes and handle access to evicted peer
2016-06-09 02:10:07 +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
fa0b3e4535
Double default for webrtc trackers (now Chrome 51 is released) #152
2016-06-07 18:50:06 +02: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
4a0758db24
Fix unnecessary escape
2016-04-23 23:02:52 -07:00
Feross Aboukhadijeh
4431ae14ab
Ensure client.destroy() callback is called when websocket pool used
...
Fixes #141
2016-03-31 21:49:18 -07:00
Feross Aboukhadijeh
2966165a8f
BREAKING: Client() takes single opts object now
...
To use the client, you used to pass in four arguments:
`new Client(peerId, port, parsedTorrent, opts)`
Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.
All options get passed in together now:
new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})
All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.
Fixes #118 . Fixes #115 .
Added ws tests for scrape.
2016-03-31 21:37:51 -07: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
f60ecec0dc
remove buffer-equals dependency
2016-03-24 03:25:31 -07:00
Feross Aboukhadijeh
35697f5187
Merge pull request #137 from fanatid/feature/buffer-equals
...
buffer-equals instead buffer-equal
2016-03-24 03:21:08 -07:00
Feross Aboukhadijeh
721a7bea7c
make server and client always send { action: 'announce' }
2016-03-23 22:04:07 -07:00
Feross Aboukhadijeh
2fffdc6730
ws server: drop support for old tracker clients
...
old clients don’t send params.action === ‘action’
2016-03-23 21:27:32 -07:00
Feross Aboukhadijeh
4159d35cfc
ws client: drop support for old tracker servers
...
Old tracker server versions don’t send data.action === ‘announce’
2016-03-23 21:26:52 -07:00
Kirill Fomichev
0193f58654
buffer-equals instead buffer-equal
2016-03-21 14:46:39 +03:00
Feross Aboukhadijeh
89b9fb7f40
prevent two reconnect timers for running at same time
2016-03-18 23:14:48 -07:00
Feross Aboukhadijeh
49025c1320
reset self.peers = {} after destroy
...
Supersedes PR #135
2016-03-18 23:12:54 -07:00
Feross Aboukhadijeh
db868cac78
guard against self.socket being null
2016-03-18 23:12:28 -07:00
Feross Aboukhadijeh
51e2439333
Lower generated offer number to 5
...
Temporary mitigation for leak issue
2016-03-16 18:06:42 -07:00
Feross Aboukhadijeh
c181020937
client: Do not include WebRTC offers with 'stopped' announce event ( fix #132 )
2016-03-16 18:04:56 -07:00
Feross Aboukhadijeh
2c23ae7f00
client: websocket: Unref peer.trackerTimeout
2016-03-16 17:59:01 -07:00
Feross Aboukhadijeh
d079171044
Fixes for PR #129
2016-03-16 17:58:47 -07:00
Yoann Ciabaud
5127aad052
Make electron webrtc working in headless and stabdard fix
2016-03-16 17:33:07 -07:00
Yoann Ciabaud
d4c34c344e
Destroy peers and tracker timeouts on destroy
2016-03-16 17:33:07 -07:00
Yoann Ciabaud
3252070328
Clear reconnect timeout on destroy
2016-03-16 17:33:06 -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
5d4cf75e0a
Merge pull request #123 from DiegoRBaquero/patch-1
...
Reconnect timeout improvement
2016-03-15 21:41:01 -07:00
Diego Rodríguez Baquero
050d95ac72
Variance and higher max
2016-03-16 01:14:24 -03:00
Feross Aboukhadijeh
8c01cb7268
do not throw and crash client
2016-03-15 20:59:04 -07:00
Feross Aboukhadijeh
ba4a52d2d1
Fixes for PR #125
2016-03-15 20:06:39 -07:00
Feross Aboukhadijeh
3d753ab805
Merge pull request #125 from yciabaud/ws-scrape
...
Scrape implementation for websocket. Issue #116
2016-03-15 19:39:59 -07:00
Feross Aboukhadijeh
6df64ffe06
Fixes for PR #126
2016-03-14 19:16:00 -07:00
Autarc
09e2b55e42
invoke callbacks of destroyed trackers
2016-03-14 17:13:34 +01:00
Yoann Ciabaud
39507bf8be
Scrape implementation for websocket. Issue #116
2016-03-14 00:36:51 +01:00
Yoann Ciabaud
eb3cefec35
Use type from server to filter peers to offer
2016-03-13 15:51:08 +01:00
Feross Aboukhadijeh
e3c65bc2a3
PR Feedback for #120
2016-03-11 17:21:19 -08:00
Diego Rodríguez Baquero
529203ea40
Max reconnect time
2016-03-11 15:26:55 -03:00
Yoann Ciabaud
af631d9fce
Merge remote-tracking branch 'upstream/master' into client-infos
2016-03-11 10:34:07 +01:00
Yoann Ciabaud
2f37e6c476
Adds a type param to identify the source of the peer
2016-03-11 10:09:09 +01:00
Diego Rodríguez Baquero
8e2dbdc576
Reconnect timeout increase lineally
...
Minimum set at 15 seconds, each retry adds 30 seconds.
2016-03-11 04:12:09 -03:00
Feross Aboukhadijeh
0585d8b18a
use delete obj[key]
instead of obj[key] = null
2016-03-10 21:26:28 -08:00
Diego Rodríguez Baquero
e185f321d3
Delete peer on announce stopped
2016-03-11 01:10:34 -03:00
Yoann Ciabaud
60f03b9529
Provide IP and HTTP headers in both HTTP and Websocket server
2016-03-03 11:10:54 +01:00
Feross Aboukhadijeh
a82f5c9878
websocket client: fix: emit 'update' when data.complete is 0
2016-02-29 14:48:59 -08:00
Feross Aboukhadijeh
b34fc100a1
fixes for PR #107
2016-02-29 12:34:06 -08:00
Feross Aboukhadijeh
1db2cb8736
Merge pull request #107 from yciabaud/announce-extension
...
Provide a way to give extra data on announce
2016-02-29 10:19:14 -08:00
Feross Aboukhadijeh
ad580c3d7c
fixes for simple-websocket@4
2016-02-15 19:38:50 -08:00
Feross Aboukhadijeh
1e919c44cb
changes for simple-get 2.0.0
2016-02-14 00:31:44 -08:00
Feross Aboukhadijeh
ab042bd2f6
remove old todo
2016-02-05 14:06:45 -08:00
Yoann Ciabaud
f1669a506e
Provide a way to give updated announce opts via callback on setInterval
2016-02-03 08:28:38 +01:00
Alex
8692e45215
Fix display error
2016-01-13 15:57:22 -05:00
Feross Aboukhadijeh
b5096e91c3
Support async createSwarm() and getSwarm()
...
Fix #95 .
Make server.getSwarm() and server.createSwarm() into async functions
that take a callback.
2016-01-03 19:50:23 +01:00
Feross Aboukhadijeh
8d735bf97d
more cleanup
2015-12-05 03:06:54 -08:00
Feross Aboukhadijeh
3f1c9644ec
50s offer timeout
2015-12-05 03:06:46 -08:00
Feross Aboukhadijeh
5687a72fdb
raise number of offers created to 10 again
2015-12-05 01:01:23 -08:00
Feross Aboukhadijeh
fe2ac4ac67
cleanup peers that never get an answer
...
attempt to fix https://github.com/feross/webtorrent/issues/502
2015-12-05 01:01:04 -08:00
Feross Aboukhadijeh
e6382c9af6
don't send peer to itself
2015-12-05 00:41:56 -08:00