mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_ws_load_test: send num_want and better offer fake type
This means wt-tracker starts sending offers
This commit is contained in:
parent
aee97b77a1
commit
01fdf40a02
4 changed files with 15 additions and 12 deletions
5
TODO.md
5
TODO.md
|
|
@ -49,9 +49,10 @@
|
|||
|
||||
## aquatic_ws_load_test
|
||||
* still maybe too few answers received with aquatic_ws
|
||||
* no offers received with wt-tracker. does it check that they are valid?
|
||||
* why does wt-tracker freak out when numwant is set to offers.len()? lots
|
||||
of broken pipe errors etc. maybe wheck source for when it sends offers
|
||||
of broken pipe errors etc. likely because it sends offers when it is set.
|
||||
* wt-tracker source: event needs to be undefined in answer for it to register
|
||||
as an answer
|
||||
|
||||
## aquatic_udp
|
||||
* handle errors similarily to aquatic_ws, including errors in socket workers
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ 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 {
|
||||
|
|
|
|||
|
|
@ -196,7 +196,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(JSON_VALUE)));
|
||||
r.answer = Some(JsonValue(::serde_json::json!({"abc": "def"})));
|
||||
r.offers = None;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ impl Connection {
|
|||
false
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("send request error: {:?}", err);
|
||||
// eprintln!("send request error: {:?}", err);
|
||||
|
||||
true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ pub fn create_random_request(
|
|||
}
|
||||
|
||||
|
||||
|
||||
#[inline]
|
||||
fn create_announce_request(
|
||||
config: &Config,
|
||||
|
|
@ -60,12 +61,16 @@ fn create_announce_request(
|
|||
|
||||
let info_hash_index = select_info_hash_index(config, &state, rng);
|
||||
|
||||
let mut offers = Vec::with_capacity(10);
|
||||
const NUM_OFFERS: usize = 2;
|
||||
|
||||
for _ in 0..10 {
|
||||
let mut offers = Vec::with_capacity(NUM_OFFERS);
|
||||
|
||||
for _ in 0..NUM_OFFERS {
|
||||
offers.push(AnnounceRequestOffer {
|
||||
offer_id: OfferId(rng.gen()),
|
||||
offer: JsonValue(::serde_json::Value::from(JSON_VALUE)),
|
||||
offer: JsonValue(::serde_json::json!(
|
||||
{"sdp": "abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-abcdefg-"}
|
||||
)),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +84,7 @@ fn create_announce_request(
|
|||
peer_id,
|
||||
bytes_left: Some(bytes_left),
|
||||
event,
|
||||
numwant: None,
|
||||
numwant: Some(offers.len()),
|
||||
offers: Some(offers),
|
||||
answer: None,
|
||||
to_peer_id: None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue