mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
http protocol: remove AnnounceRequest::compact, fail parsing if set to 0
This commit is contained in:
parent
71c070cf98
commit
9f8f80a17b
3 changed files with 0 additions and 11 deletions
3
TODO.md
3
TODO.md
|
|
@ -8,9 +8,6 @@
|
||||||
* test ip format
|
* test ip format
|
||||||
* site will likely want num_seeders and num_leechers for all torrents..
|
* site will likely want num_seeders and num_leechers for all torrents..
|
||||||
|
|
||||||
* aquatic_http_protocol
|
|
||||||
* don't require compact=1?
|
|
||||||
|
|
||||||
## Medium priority
|
## Medium priority
|
||||||
|
|
||||||
* Use thin LTO?
|
* Use thin LTO?
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ fn create_announce_request(config: &Config, state: &LoadTestState, rng: &mut imp
|
||||||
event,
|
event,
|
||||||
key: None,
|
key: None,
|
||||||
numwant: None,
|
numwant: None,
|
||||||
compact: true,
|
|
||||||
port: rng.gen(),
|
port: rng.gen(),
|
||||||
bytes_uploaded: 0,
|
bytes_uploaded: 0,
|
||||||
bytes_downloaded: 0,
|
bytes_downloaded: 0,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ pub struct AnnounceRequest {
|
||||||
pub bytes_downloaded: usize,
|
pub bytes_downloaded: usize,
|
||||||
pub bytes_left: usize,
|
pub bytes_left: usize,
|
||||||
pub event: AnnounceEvent,
|
pub event: AnnounceEvent,
|
||||||
pub compact: bool,
|
|
||||||
/// Number of response peers wanted
|
/// Number of response peers wanted
|
||||||
pub numwant: Option<usize>,
|
pub numwant: Option<usize>,
|
||||||
pub key: Option<SmartString<LazyCompact>>,
|
pub key: Option<SmartString<LazyCompact>>,
|
||||||
|
|
@ -50,9 +49,6 @@ impl AnnounceRequest {
|
||||||
AnnounceEvent::Empty => (),
|
AnnounceEvent::Empty => (),
|
||||||
};
|
};
|
||||||
|
|
||||||
output.write_all(b"&compact=")?;
|
|
||||||
output.write_all(itoa::Buffer::new().format(self.compact as u8).as_bytes())?;
|
|
||||||
|
|
||||||
if let Some(numwant) = self.numwant {
|
if let Some(numwant) = self.numwant {
|
||||||
output.write_all(b"&numwant=")?;
|
output.write_all(b"&numwant=")?;
|
||||||
output.write_all(itoa::Buffer::new().format(numwant).as_bytes())?;
|
output.write_all(itoa::Buffer::new().format(numwant).as_bytes())?;
|
||||||
|
|
@ -162,7 +158,6 @@ impl AnnounceRequest {
|
||||||
bytes_downloaded: opt_bytes_downloaded.with_context(|| "no downloaded")?,
|
bytes_downloaded: opt_bytes_downloaded.with_context(|| "no downloaded")?,
|
||||||
bytes_left: opt_bytes_left.with_context(|| "no left")?,
|
bytes_left: opt_bytes_left.with_context(|| "no left")?,
|
||||||
event,
|
event,
|
||||||
compact: true,
|
|
||||||
numwant: opt_numwant,
|
numwant: opt_numwant,
|
||||||
key: opt_key,
|
key: opt_key,
|
||||||
})
|
})
|
||||||
|
|
@ -352,7 +347,6 @@ mod tests {
|
||||||
bytes_downloaded: 2,
|
bytes_downloaded: 2,
|
||||||
bytes_left: 3,
|
bytes_left: 3,
|
||||||
event: AnnounceEvent::Started,
|
event: AnnounceEvent::Started,
|
||||||
compact: true,
|
|
||||||
numwant: Some(0),
|
numwant: Some(0),
|
||||||
key: Some("4ab4b877".into()),
|
key: Some("4ab4b877".into()),
|
||||||
})
|
})
|
||||||
|
|
@ -400,7 +394,6 @@ mod tests {
|
||||||
bytes_downloaded: Arbitrary::arbitrary(g),
|
bytes_downloaded: Arbitrary::arbitrary(g),
|
||||||
bytes_left: Arbitrary::arbitrary(g),
|
bytes_left: Arbitrary::arbitrary(g),
|
||||||
event: Arbitrary::arbitrary(g),
|
event: Arbitrary::arbitrary(g),
|
||||||
compact: true,
|
|
||||||
numwant: Arbitrary::arbitrary(g),
|
numwant: Arbitrary::arbitrary(g),
|
||||||
key: key.map(|key| key.into()),
|
key: key.map(|key| key.into()),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue