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
|
## aquatic_ws_load_test
|
||||||
* still maybe too few answers received with aquatic_ws
|
* 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
|
* 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
|
## aquatic_udp
|
||||||
* handle errors similarily to aquatic_ws, including errors in socket workers
|
* handle errors similarily to aquatic_ws, including errors in socket workers
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@ use rand_distr::Pareto;
|
||||||
pub use aquatic_ws_protocol::*;
|
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)]
|
#[derive(PartialEq, Eq, Clone)]
|
||||||
pub struct TorrentPeer {
|
pub struct TorrentPeer {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ impl Connection {
|
||||||
if let Some((peer_id, offer_id)) = self.send_answer {
|
if let Some((peer_id, offer_id)) = self.send_answer {
|
||||||
r.to_peer_id = Some(peer_id);
|
r.to_peer_id = Some(peer_id);
|
||||||
r.offer_id = Some(offer_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;
|
r.offers = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ impl Connection {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
eprintln!("send request error: {:?}", err);
|
// eprintln!("send request error: {:?}", err);
|
||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ pub fn create_random_request(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn create_announce_request(
|
fn create_announce_request(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
|
|
@ -59,13 +60,17 @@ fn create_announce_request(
|
||||||
};
|
};
|
||||||
|
|
||||||
let info_hash_index = select_info_hash_index(config, &state, rng);
|
let info_hash_index = select_info_hash_index(config, &state, rng);
|
||||||
|
|
||||||
let mut offers = Vec::with_capacity(10);
|
|
||||||
|
|
||||||
for _ in 0..10 {
|
const NUM_OFFERS: usize = 2;
|
||||||
|
|
||||||
|
let mut offers = Vec::with_capacity(NUM_OFFERS);
|
||||||
|
|
||||||
|
for _ in 0..NUM_OFFERS {
|
||||||
offers.push(AnnounceRequestOffer {
|
offers.push(AnnounceRequestOffer {
|
||||||
offer_id: OfferId(rng.gen()),
|
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,
|
peer_id,
|
||||||
bytes_left: Some(bytes_left),
|
bytes_left: Some(bytes_left),
|
||||||
event,
|
event,
|
||||||
numwant: None,
|
numwant: Some(offers.len()),
|
||||||
offers: Some(offers),
|
offers: Some(offers),
|
||||||
answer: None,
|
answer: None,
|
||||||
to_peer_id: None,
|
to_peer_id: None,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue