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.
Matt Joiner [Tue, 27 Oct 2020 03:10:17 +0000 (14:10 +1100)]
Return errors from Reader if data downloading won't occur
Chunk write errors to storage can disable data download. Previously Readers would wait indefinitely for the data to become available. This change returns an error instead of stalling.
Matt Joiner [Tue, 27 Oct 2020 01:59:07 +0000 (12:59 +1100)]
Don't block trying to fill entire Reader.Read
This conforms more to the contract in io.Reader. It's possible the old behaviour was better in reducing overhead, but that can be iterated on (or added as comments next time).
Matt Joiner [Thu, 15 Oct 2020 04:45:08 +0000 (15:45 +1100)]
Sanitize metainfo file paths for file-based storage
Fixes exploit where specially crafted infos can cause the client to write files to arbitrary locations on local storage when using file-based storages like mmap and file.