Justin M [Tue, 5 Jan 2021 05:40:44 +0000 (05:40 +0000)]
Ping websocket to ensure connect remains online.
OpenWebTorrent disconnects clients after two minutes of inactivity. In a scenario where an
announce occurs and no other activity occurs for the (default) 120-second idle timer, the
websocket will be torn down by OpenWebTorrent. This in turn causes the tracker client to wait one
minute, reconnect, and reannounce its peers.
This patch sends a websocket.PingMessage every 60 seconds to maintain the connection.
Justin M [Mon, 4 Jan 2021 22:54:07 +0000 (22:54 +0000)]
Align webtorrent tracker to BEP-3
Adding "omitempty" to json marshalling, bringing the webtorrent tracker AnnounceRequest in line
with BEP-3, which states omitting the the "event" field is acceptable.
Justin M [Mon, 4 Jan 2021 23:20:51 +0000 (23:20 +0000)]
Reannounce webtorrent webrtc offers on reconnect
On socket reconnect, reannounce any webrtc offers that might have been half-open before the
socket reconnected. This implementation closes any existing half-open offers and republishes them,
but does nothing to existing webrtc connections which are still running (these are cleaned up
elsewhere and are not owned by this code)
Matt Joiner [Thu, 10 Dec 2020 00:13:27 +0000 (11:13 +1100)]
Don't send keepalives if a connection isn't useful to us
This might help break the situation where anacrolix/torrent Clients that are connected to each other never release a connection until there's new connections that look more promising.
Aranjedeath [Wed, 9 Dec 2020 05:27:50 +0000 (21:27 -0800)]
Update metainfo.go
delete "yoloham" so that is no longer the default comment string on torrents made without a comment specified. Should resolve https://github.com/anacrolix/torrent/issues/342
Matt Joiner [Thu, 5 Nov 2020 23:36:49 +0000 (10:36 +1100)]
Replace storage.IncompletePieceToWriter with io.Writer
It was incorrect to assume piece hashing only operates on incomplete chunk data. This actually uncovered a bug where duplicate hash checks occurred, and the redundant checks would fail due to not reading the completed data.
Matt Joiner [Thu, 5 Nov 2020 21:39:56 +0000 (08:39 +1100)]
Fix piece getting queued for hash multiple times
Pieces could get queued for hash multiple times when we receive chunks if the piece starts getting hashed before we're done writing all the chunks out. This was only found because piece hashing currently only checks the incomplete data, which is missing after the first piece hash passes, the data is marked complete, then the subsequently queued hash has nothing to read.
Matt Joiner [Fri, 30 Oct 2020 01:19:53 +0000 (12:19 +1100)]
Don't delete requests until after they're written to disk
This prevents too many pending writes building up. Webseed peers re-request synchronously, and the writes are done asynchronously, so they download too quickly and there was no backpressure. The backpressure now is provided by the upper limit on outstanding requests per connection.
Matt Joiner [Thu, 29 Oct 2020 23:47:50 +0000 (10:47 +1100)]
sqlite storage: Force data to be used as a blob
There's a bug in crawshaw.io/sqlite, and some forks where inserting []byte results in a text type instead of blob. To ensure things work correctly, we coerce data to blob wherever we can. See https://github.com/crawshaw/sqlite/issues/94 and the fork that fixes it.
Matt Joiner [Wed, 28 Oct 2020 23:45:38 +0000 (10:45 +1100)]
Fix peer request sleepiness
New requests weren't being issued to the current peer when being deleted. For webseeds, this would cause them to not bother issuing new requests indefinitely.