From a18596544fd6e6eb2511713ea0724f8f0e3ae01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sun, 2 Aug 2020 10:03:42 +0200 Subject: [PATCH] aquatic http protocol: allow non-existing peers in Response Really, this is to allow missing peers6 --- aquatic_http_protocol/src/response.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aquatic_http_protocol/src/response.rs b/aquatic_http_protocol/src/response.rs index 87a5d74..76335dc 100644 --- a/aquatic_http_protocol/src/response.rs +++ b/aquatic_http_protocol/src/response.rs @@ -15,7 +15,7 @@ pub struct ResponsePeer{ } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)] #[serde(transparent)] pub struct ResponsePeerListV4( #[serde( @@ -26,7 +26,7 @@ pub struct ResponsePeerListV4( ); -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)] #[serde(transparent)] pub struct ResponsePeerListV6( #[serde( @@ -51,7 +51,9 @@ pub struct AnnounceResponse { pub announce_interval: usize, pub complete: usize, pub incomplete: usize, + #[serde(default)] pub peers: ResponsePeerListV4, + #[serde(default)] pub peers6: ResponsePeerListV6, }