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

View file

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