Jimmy Zelinskie
c0c3eda290
config: make reaping configurable
...
This allows for configurable reaping rates and changes the default to
what many public trackers use in the wild.
2015-09-18 01:27:27 -04:00
Jimmy Zelinskie
dfd59e8823
tracker: fix logic recording complete events
...
520a357
inadvertently changed the logic on how many times
leecherFinished was being called and recording completion events to the
stats. This commit makes this that clearer and avoids over incrementing
the number of Seeders in our stats.
2015-08-26 16:59:25 -04:00
Jimmy Zelinskie
520a357e37
tracker: remove last "bad request"
...
A peer can join a swarm immediately as completed if they already have
the file before they ever announce. If we don't have them in our
leechers, we were previously failing to add them as a seeder.
2015-06-27 00:09:57 -04:00
Jimmy Zelinskie
744313d253
tracker: rm badrequest when state is unknown
...
This assumption was just totally wrong. If there is any kind of packet
loss or the tracker starts up to a pre-existing swarm, all the peers
will get bad request responses.
2015-06-26 22:49:09 -04:00
Jimmy Zelinskie
938542ac74
models: Announce field for AnnounceResponse
2015-04-04 15:42:28 -04:00
Jimmy Zelinskie
222415f467
udp: Implement draft of BEP45; Endpoint type added
...
Because of the requirement of storing multiple ports, Announce.Port has
been abolished and Announce.IPv4/IPv6 have been replaced with the
Endpoint type. HTTP has been updated to support this model. UDP has been
updated to support the latest draft of BEP45 and most of the
optional-types described in BEP41.
2015-03-29 03:03:19 -04:00
Jimmy Zelinskie
f25464a02b
Merge branch 'master' into udp
2015-03-27 22:05:48 -04:00
Jimmy Zelinskie
b93cc26b98
models: properly format port into peerkey string
2015-03-26 22:11:13 -04:00
Jimmy Zelinskie
1bf788a99b
tracker: fix reference to config
2015-03-23 20:43:33 -04:00
Jimmy Zelinskie
80c068c97a
config: add create_on_announce option
...
This option allows the user to specify whether or not to create a new
swarm for torrents that do not previously exist within the tracker's
storage.
2015-03-23 20:02:13 -04:00
Jimmy Zelinskie
6188d52de0
models: Port method for PeerKey
...
This also adds some more docs for related stuff in the models package.
2015-03-22 19:41:57 -04:00
Jimmy Zelinskie
92866cfacd
models: include port in peerkey
2015-03-22 18:44:09 -04:00
Justin Li
da46ef8c8a
tracker: Return announcing peer if there are no others to avoid an empty peers field
2015-02-28 00:56:45 -05:00
Jimmy Zelinskie
ac2fcade1e
tracker: record announce/scrape stats in handlers
...
This deduplicates code tracking the stats code tracking announces and
scrapes for each protocol. The down side is that it isn't aware of any
failures writing responses, but it was already being called before the
write to a response for HTTP.
2015-02-26 09:03:52 -05:00
Justin Li
7512f50731
udp: Add basic UDP tests
2015-02-21 14:35:21 -05:00
Justin Li
669128c83a
tracker: Pass listen address into tracker.Server.Serve()
2015-02-21 13:16:21 -05:00
Justin Li
b6c1b3838b
tracker: Remove impossible code for 'completed' event
2015-02-21 13:00:23 -05:00
Justin Li
afb22c3df6
udp: Add basic logging and more comments
2015-02-20 14:08:46 -05:00
Justin Li
92f3c62456
tracker: Add common interface to start and stop servers
2015-02-20 13:39:19 -05:00
Justin Li
e3aff35532
models: Use a uint16 for port numbers
2015-02-20 02:06:44 -05:00
Justin Li
d9a7611eee
http: Unexport announce/scrape creation functions
2015-02-20 01:36:49 -05:00
Jimmy Zelinskie
e02f1dd0ea
tracker: stop exporting shard methods
2015-02-08 17:14:05 -05:00
Justin Li
87c68f1973
2015 ✨
2015-01-01 12:02:25 -05:00
Jimmy Zelinskie
ddd10d9732
Begin refactor to better encapsulate configuration
...
This also updates the example_config.json which did not previously work.
Config.Config is now composed of embedded structs of other configs that
can later be used to clearly have a separation of concerns.
2014-11-01 20:12:40 -04:00
Jimmy Zelinskie
d754b5b376
Return PeerMap by reference.
...
In accordance with `go vet`, locks should only be returned by reference.
2014-10-28 12:28:51 -04:00
Jimmy Zelinskie
d46beb0f7d
Remove unkeyed composite literals.
...
This was done to keep in accordance with `go vet`.
2014-10-28 12:26:37 -04:00
Jimmy Zelinskie
deb44da5f0
add missing json struct tag
2014-09-29 15:14:46 -04:00
Paul Saab
be2ddb7e4d
Fix IPv4 stats
...
net.ParseIP() will return a v4mapped address which makes len(ip) ==
IPv6len and breaks stats for IPv4 requests.
2014-09-29 11:55:18 -07:00
Paul Saab
2b8dec07fe
Use atomics to track peermap size
2014-09-24 16:24:36 -07:00
Paul Saab
47613d4bbd
Track the total size of the of the torrents map
2014-09-24 16:24:14 -07:00
Paul Saab
f74ef67d08
Only decrement torrent map size if hash exists
2014-09-24 16:22:14 -07:00
Paul Saab
ad9034da6d
Reduce contention on the torrent map
...
We see the torrent map have quite a bit of contention. Shard the map by
a configurable number of shards to reduce the times we may contend on
the lock.
2014-09-24 10:23:16 -07:00
Jimmy Zelinskie
b910fdabf5
Organize peers by subnet.
...
This commit restructures PeerMaps to be a map from Subnet to
PeerID to Peer. This reduces the complexity require to gather peers from
the same subnet.
2014-09-23 23:00:50 -04:00
Jimmy Zelinskie
6a96245d90
AppendPeers now uses readlock.
2014-09-15 22:14:27 -04:00
Justin Li
976a983aa7
go fmt [ci skip]
2014-09-03 10:18:26 -04:00
Jimmy Zelinskie
0f0296be1e
Address missing copyright on storage.go [ci skip]
2014-09-03 00:57:11 -04:00
Jimmy Zelinskie
f001489294
Unlock torrent mutex when continuing purge loop.
2014-09-03 00:52:21 -04:00
Cooper Lees
26de6d2e9c
Respect a clients AF Optional Support - config driven
2014-08-21 07:11:35 -07:00
Jimmy Zelinskie
1d9b2bc322
First step towards removing Tracker Driver.
...
This feature isn't worth maintaining and if anyone needs to scale beyond
memory on a single box, we can evaluate it then.
2014-08-13 17:45:34 -04:00
Jimmy Zelinskie
fc18028796
Fix Purge reporting all peers as Seeders
...
PeerMaps now are constructed with a boolean value that tells the map
whether they are hosting seeders or leechers.
2014-08-05 06:57:48 -04:00
Jimmy Zelinskie
01fa778ce2
JSON Encoding for PeerMaps
2014-08-04 07:05:13 -04:00
Jimmy Zelinskie
9e45f77efe
Create peermap.go, add documentation
2014-08-04 06:37:31 -04:00
Jimmy Zelinskie
3cb286fb40
Introduce thread-safe PeerMap
2014-08-04 06:15:08 -04:00
Justin Li
d610b4ebb0
Address easy golint comments
2014-08-01 16:16:38 -04:00
Justin Li
a55219963b
Prevent unsigned overflow from breaking stats
2014-08-01 16:11:34 -04:00
Justin Li
ac61c7880d
Record raw upload/download
2014-08-01 16:07:10 -04:00
Jimmy Zelinskie
8051e0e22e
Calculate delta based off of old peer
2014-08-01 15:51:26 -04:00
Jimmy Zelinskie
5622a3ded2
Only calculate delta if tracker is private
2014-08-01 15:19:27 -04:00
Jimmy Zelinskie
f747a79c8c
Calculate up/down delta before altering peer
2014-08-01 15:11:37 -04:00
Justin Li
f48e1e452f
Don't write to the peer maps in the announce code
2014-08-01 14:09:29 -04:00