Commit Graph

10 Commits

Author SHA1 Message Date
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
3a0fec0701 standard fixes 2016-11-22 19:52:01 -03: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
e3c65bc2a3 PR Feedback for #120 2016-03-11 17:21:19 -08:00
Yoann Ciabaud
2f37e6c476 Adds a type param to identify the source of the peer 2016-03-11 10:09:09 +01: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
68f2317870 Revert "prevent "value out of bounds error""
This reverts commit 25b25f663c.
2015-05-03 16:46:39 -07:00
Feross Aboukhadijeh
25b25f663c prevent "value out of bounds error"
For #72
2015-05-01 21:32:54 -07:00
Feross Aboukhadijeh
1ff5769054 add support for webtorrent (websocket) trackers 2015-03-24 01:52:35 -07:00