Commit Graph

249 Commits

Author SHA1 Message Date
Astro
2f7a7131d0 server: make onHttpRequest() part of public API 2014-12-12 16:52:13 +01:00
Astro
3b4b487c2c examples/express-embed 2014-12-12 16:51:37 +01:00
Feross Aboukhadijeh
79068a49cf Use hex info_hash and peer_id throughout 2014-12-12 02:02:11 -08:00
Astro
991363a28c Revert "server _onHttpRequest(): ensure non-empty params"
This reverts commit 74d9139049.

Conflicts:
	server.js

feross commented on 74d9139 5 hours ago
> Do we need to check for empty params here?
>
> _onRequest should return an error via callback because
> params.action is missing. Won't that work?
74d9139049 (commitcomment-8937428)
2014-12-12 02:57:01 +01:00
Feross Aboukhadijeh
66b71db8f5 Merge pull request #46 from feross/astro-fixes
swarm.announce() should always call callback
2014-12-11 17:45:51 -08:00
Feross Aboukhadijeh
c75ca05479 swarm.announce() should always call callback
It’s important that calls to swarm.announce() always calls the callback
that it’s passed otherwise http announce/scrape requests
will hang (because res.end() is never called).

Also, since this swarm implementation is in-memory, we can get rid of
the callbacks to internal functions.

Lastly, fixed references to non-existent start() function.
2014-12-11 13:43:11 -08:00
Feross Aboukhadijeh
edb5c6e854 code style 2014-12-11 12:53:39 -08:00
Feross Aboukhadijeh
20cb18272e Merge pull request #45 from feross/refactor
Refactor the server-side code
2014-12-11 12:38:32 -08:00
Astro
c97e4236f4 server parseHttpRequest(): simplify info_hash checking 2014-12-11 17:07:37 +01:00
Astro
217bcf7de5 server _onUdpRequest(): don't check empty params, errors will be thrown now 2014-12-11 16:39:10 +01:00
Astro
7a8f9a779f server _onHttpRequest(): don't wrap errors in errors 2014-12-11 16:24:33 +01:00
Astro
74d9139049 server _onHttpRequest(): ensure non-empty params 2014-12-11 16:22:17 +01:00
Astro
e64fecc063 parseUdpRequest(): throw on invalid packet 2014-12-11 16:19:08 +01:00
Astro
7a417a591d parseUdpRequest(): fix params.ip 2014-12-11 16:11:12 +01:00
Astro
e234f14d56 server swarm: split out announce events 2014-12-10 17:01:34 +01:00
Astro
8439300df9 server: unify compact serialization 2014-12-10 16:51:35 +01:00
Astro
b72960dee3 server: split out Swarm 2014-12-10 16:47:41 +01:00
Astro
1c754a2f49 move parseHttpRequest(), parseUdpRequest() to lib/parse_{http,udp}.js 2014-12-10 00:44:45 +01:00
Astro
aea3c44c08 server: expose getSwarm()
drops capability to pass a *hex* infoHash
2014-12-09 23:18:47 +01:00
Astro
fee289b074 server: rm superfluous action fields 2014-12-09 23:18:35 +01:00
Astro
366b49bf06 server: split out _onRequest() et al 2014-12-09 02:35:05 +01:00
Astro
85be917d51 server: replace request string by action number 2014-12-09 00:29:02 +01:00
Astro
0bc88bcf22 server: split out parseUdpRequest() 2014-12-09 00:22:36 +01:00
Astro
037a53accb server: split out parseHttpRequest() 2014-12-08 23:42:05 +01:00
Astro
28189a0b12 server tests: fix serverType in announceUrl 2014-12-05 02:41:57 +01:00
Astro
f77015c046 server tests: run udp tests with udp 2014-12-04 17:38:03 +01:00
Feross Aboukhadijeh
8ef041f4f8 2.9.1 2014-11-27 17:32:38 +08:00
Feross Aboukhadijeh
84f6107345 check for domain names in data.peers6 2014-11-27 17:31:49 +08:00
Feross Aboukhadijeh
0b831d2fde actually iterate over ipv6 peers 2014-11-27 17:31:33 +08:00
Feross Aboukhadijeh
0c709523df 2.9.0 2014-11-26 20:21:49 +08:00
Feross Aboukhadijeh
6db96d6125 bn.js@0.15 & bump dev-deps 2014-11-26 20:20:23 +08:00
Feross Aboukhadijeh
d7c4af4ce8 handle case where server returns ip in square brackets 2014-11-26 20:18:56 +08:00
Feross Aboukhadijeh
b079bad35a code style 2014-11-26 20:18:56 +08:00
Feross Aboukhadijeh
32b622aa51 cleanup tests 2014-11-26 20:18:56 +08:00
Astro
1ca387f2fe client IPv6 support [BEP-7] 2014-11-26 20:18:56 +08:00
Feross Aboukhadijeh
54b8d7112a 2.8.2 2014-11-26 17:40:59 +08:00
Feross Aboukhadijeh
2824f16c49 don't assume peer var will exist 2014-11-26 17:40:34 +08:00
Feross Aboukhadijeh
20d08f6d03 2.8.1 2014-11-26 16:22:12 +08:00
Feross Aboukhadijeh
deee4e1d7d fix client handling to support http peers non-compact response 2014-11-26 16:21:45 +08:00
Astro
4f1ea32f35 client _handleResponse: allow string form of peer.ip 2014-11-26 16:20:14 +08:00
Feross Aboukhadijeh
7376843920 2.8.0 2014-11-26 15:27:31 +08:00
Feross Aboukhadijeh
026f2c2de0 Recover from unexpected events better
When you restart the tracker server, all peers it's tracking are
discarded. Then, clients that are already running will continue to send
`update` events, but the tracker throws them away because it was
expected to get a `start` event first.

This should only be a warning, and not a fatal error. I just made the
following changes:

- unexpected `started` event (for peer already in swarm) is treated as
an `update`
- unexpected `stopped` event is discarded
- unexpected `completed` event is treated as a `start`
- unexpected `update` event (from peer not in swarm) is treated as
`start`

Fixes #42
2014-11-26 15:27:02 +08:00
Feross Aboukhadijeh
b44715d37a 2.7.0 2014-10-06 23:14:35 -07:00
Feross Aboukhadijeh
07850cdc13 Fixes for PR #39
- emit 'warning' instead of 'error' because it's not a fatal error,
just a bad tracker response.
- made the try block more concise so it only catches the errors from
`string2compact`
2014-10-06 23:14:09 -07:00
Feross Aboukhadijeh
7e081f88d1 Merge pull request #39 from Theadd/master
handle .* IP/PORTs (6 bytes) error
2014-10-06 23:10:27 -07:00
Theadd
e898ef45f6 handle .* IP/PORTs (6 bytes) error 2014-09-24 18:03:30 +02:00
Feross Aboukhadijeh
a357dd2957 2.6.1 2014-09-16 19:58:24 -07:00
Feross Aboukhadijeh
1e354c8f22 debug@2 and bn.js@0.14 2014-09-16 19:58:05 -07:00
Feross Aboukhadijeh
b956132918 update dep 2014-09-09 09:39:49 +01:00
Feross Aboukhadijeh
0edafda089 2.6.0 2014-08-18 01:40:52 -07:00