aquatic_http: AnnounceRequest.compact: default to true

This commit is contained in:
Joakim Frostegård 2020-07-02 15:57:16 +02:00
parent ff4fcc163d
commit 1eaf2a0351
2 changed files with 8 additions and 3 deletions

View file

@ -16,7 +16,6 @@
* move stuff to common crate with ws: what about Request/InMessage etc?
* info hashes, peer ids: check that whole deserialization and url decoding
works as it should. There are suspicously many `\u{fffd}`
* AnnounceRequest.compact: handle that it is optional
## aquatic_ws
* tests

View file

@ -74,15 +74,21 @@ pub struct AnnounceRequest {
pub bytes_left: usize,
#[serde(default)]
pub event: AnnounceEvent,
/// FIXME: is optional, so should default to something, maybe `true`
#[serde(
deserialize_with = "deserialize_bool_from_number"
deserialize_with = "deserialize_bool_from_number",
default = "AnnounceRequest::default_compact_value"
)]
pub compact: bool,
/// Requested number of peers to return
pub numwant: usize,
}
impl AnnounceRequest {
fn default_compact_value() -> bool {
true
}
}
#[derive(Debug, Clone, Serialize)]
pub struct AnnounceResponseSuccess {