From 953154824e8254ce1c277e365e3569cecd6f514c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 1 Aug 2020 22:57:13 +0200 Subject: [PATCH] aquatic ws load test: use longer value for request offer/answer fields --- aquatic_ws_load_test/src/common.rs | 4 ++++ aquatic_ws_load_test/src/network.rs | 2 +- aquatic_ws_load_test/src/utils.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/aquatic_ws_load_test/src/common.rs b/aquatic_ws_load_test/src/common.rs index c982d77..b1075fe 100644 --- a/aquatic_ws_load_test/src/common.rs +++ b/aquatic_ws_load_test/src/common.rs @@ -5,6 +5,10 @@ use rand_distr::Pareto; pub use aquatic_ws_protocol::*; +/// JSON string used as fake announce offer / offer response +pub const JSON_VALUE: &str = r#"{ "offer": "abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh" }"#; + + #[derive(PartialEq, Eq, Clone)] pub struct TorrentPeer { pub info_hash: InfoHash, diff --git a/aquatic_ws_load_test/src/network.rs b/aquatic_ws_load_test/src/network.rs index 4854958..6bbeb3d 100644 --- a/aquatic_ws_load_test/src/network.rs +++ b/aquatic_ws_load_test/src/network.rs @@ -201,7 +201,7 @@ impl Connection { if let Some((peer_id, offer_id)) = self.send_answer { r.to_peer_id = Some(peer_id); r.offer_id = Some(offer_id); - r.answer = Some(JsonValue(::serde_json::Value::from("{}"))); + r.answer = Some(JsonValue(::serde_json::Value::from(JSON_VALUE))); r.offers = None; } diff --git a/aquatic_ws_load_test/src/utils.rs b/aquatic_ws_load_test/src/utils.rs index 64c889b..096e6b4 100644 --- a/aquatic_ws_load_test/src/utils.rs +++ b/aquatic_ws_load_test/src/utils.rs @@ -62,7 +62,7 @@ fn create_announce_request( for _ in 0..10 { offers.push(AnnounceRequestOffer { offer_id: OfferId(rng.gen()), - offer: JsonValue(::serde_json::Value::from("{}")), + offer: JsonValue(::serde_json::Value::from(JSON_VALUE)), }) }