Commit Graph

121 Commits

Author SHA1 Message Date
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
Feross Aboukhadijeh
0150982b9e :: is already the default for node's http 2016-02-23 12:51:28 -08: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
b5de10156d http server: fix bug in how peer ids are returned 2016-01-02 23:36:10 +01:00
Feross Aboukhadijeh
4816eb7a41 send 404 response when req headers are not sent 2015-12-17 00:41:07 +13:00
Feross Aboukhadijeh
5953841466 allow user to intercept 'request' event for http tracker 2015-12-17 00:40:46 +13:00
Feross Aboukhadijeh
714e876777 Give user chance to specify their own default http request handler 2015-12-16 12:37:53 +13:00
Feross Aboukhadijeh
c0555f4e1d style 2015-12-16 12:19:44 +13:00
Feross Aboukhadijeh
f56ca3031b WebSocket tracker should have a shorter interval – default: 2 minutes 2015-12-05 00:18:52 -08:00
Feross Aboukhadijeh
b4ec6fcbc4 fix huge websocket tracker interval 2015-12-05 00:02:57 -08:00
Feross Aboukhadijeh
d29367a4a0 if server.close() is called, end http response object 2015-08-24 00:11:21 +02:00
Linus Unnebäck
4ef0426b90 adhere to padded-blocks 2015-08-14 22:31:22 +02:00
Feross Aboukhadijeh
6935841d56 better debug log 2015-07-29 05:19:57 -07:00
Feross Aboukhadijeh
9db28c2fad massive cleanup 2015-07-29 01:47:09 -07:00
Feross Aboukhadijeh
3746c05d79 restructure folders 2015-07-29 00:26:44 -07:00
Feross Aboukhadijeh
c4ee7aae36 fix thrown exception when websocket connection is aborted
alternative to https://github.com/feross/bittorrent-tracker/pull/89
2015-07-22 16:30:52 -07:00
Feross Aboukhadijeh
82aea33dfa add server.ws.address() function 2015-07-16 18:31:13 -07:00
Feross Aboukhadijeh
89b3fb3086 support custom filter error messages
In addition to returning a boolean (`true` for allowed, `false` for
disallowed), you can return an `Error` object to disallow and provide a
custom reason.

Fixes #85
2015-07-08 10:13:52 -07:00
Feross Aboukhadijeh
f13accfc42 server: Enable WebSocket server by default 2015-07-08 09:44:00 -07:00
Feross Aboukhadijeh
834bf1db5e server: http reqs 404 when only ws server is used 2015-07-08 09:43:47 -07:00
Feross Aboukhadijeh
bf5b9f289a BREAKING: opts.filter function is async; add createSwarm
- The expected signature for opts.filter is now:

function myFilterFn (infoHash, params, cb) {
  cb(infoHash === 'blah)
}

This allows interfacing with a database and fixes #80.

Also, swarm.getSwarm() is no longer responsible for creating a Swarm
instance, only returning an instance if there is already one. Creating
a swarm happens in swarm.createSwarm(). This change only affects users
who were override swarm.getSwarm().
2015-07-04 17:13:07 -07:00
Feross Aboukhadijeh
8532426a87 Use anonymous functions
- allows overriding `onHttpRequest` on the tracker instance, instead of
only on the prototype
- plus, better perf (in theory)
2015-07-02 16:24:03 -07:00
Feross Aboukhadijeh
67291edfb3 server: emit full params object on server events
Fixes #81
2015-06-24 01:48:59 -07:00
Feross Aboukhadijeh
4816796fda throw when listen is called twice in a row 2015-06-09 22:32:04 -07:00
Feross Aboukhadijeh
5be05f2794 Don't return if not listening (in onXXXXRequest)
Fixes #79
2015-06-09 22:25:25 -07:00
Feross Aboukhadijeh
ae9a99a6dc add node 0.10 support back after PR 2015-05-29 21:05:00 -07:00
Garret Buell
e5531a315f reuseAddr for dgram.CreateSocket
Creating a udp4 and udp6 socket on the same port can result in "ERROR: bind EADDRINUSE". Passing reuseAddr: true fixes this.
2015-05-29 10:43:35 -07:00
Feross Aboukhadijeh
340b3faff2 server: always send binary ids 2015-05-27 12:59:12 +02:00