Allocate jobids randomly, Steam seems to do that now

This commit is contained in:
Artemis Tosini 2024-08-27 21:56:23 +00:00
parent 70271a9ce0
commit 6e2eb1aea0
Signed by: artemist
GPG key ID: EE5227935FE3FF18
2 changed files with 4 additions and 9 deletions

View file

@ -55,8 +55,6 @@ pub async fn bootstrap_find_servers() -> eyre::Result<Vec<String>> {
struct SessionInner { struct SessionInner {
/// Steam ID of current user. When set to None we are not logged in /// Steam ID of current user. When set to None we are not logged in
steam_id: Option<u64>, steam_id: Option<u64>,
/// Next jobid to use for messages that start a "job"
next_jobid: u64,
/// Realm we're connecting to. AIUI this corresponds to account universe. /// Realm we're connecting to. AIUI this corresponds to account universe.
/// Should normally be 1 for Public /// Should normally be 1 for Public
realm: u32, realm: u32,
@ -69,9 +67,9 @@ struct SessionInner {
/// Waker for the sending thread /// Waker for the sending thread
send_waker: Option<Waker>, send_waker: Option<Waker>,
/// Recievers waiting for responses by job id /// Recievers waiting for responses by jobid
receive_wakers: HashMap<u64, Waker>, receive_wakers: HashMap<u64, Waker>,
/// Messages ready for receivers by job id /// Messages ready for receivers by jobid
/// TODO: Support multiple messages for same job ID /// TODO: Support multiple messages for same job ID
receive_messages: HashMap<u64, CMRawProtoBufMessage>, receive_messages: HashMap<u64, CMRawProtoBufMessage>,
@ -81,9 +79,7 @@ struct SessionInner {
impl SessionInner { impl SessionInner {
pub fn alloc_jobid(&mut self) -> u64 { pub fn alloc_jobid(&mut self) -> u64 {
let jobid = self.next_jobid; rand::random()
self.next_jobid += 1;
jobid
} }
pub fn wake_sender(&mut self) { pub fn wake_sender(&mut self) {
@ -221,7 +217,6 @@ impl CMSession {
let inner = SessionInner { let inner = SessionInner {
steam_id: None, steam_id: None,
next_jobid: 0,
realm: 1, realm: 1,
client_session_id: 0, client_session_id: 0,
send_queue: VecDeque::new(), send_queue: VecDeque::new(),

View file

@ -28,7 +28,7 @@
protobuf protobuf
]; ];
RUST_SRC_PATH = "${rustPackages.rustPlatform.rustLibSrc}"; RUST_SRC_PATH = "${rustPackages.rustPlatform.rustLibSrc}";
RUST_LOG = "trace"; RUST_LOG = "debug,vapored=trace,vapore-client=trace";
}; };
formatter = pkgs.nixfmt-rfc-style; formatter = pkgs.nixfmt-rfc-style;