Skip to content

Commit 073ba53

Browse files
committed
Legacy-proxy: Send a new request after first connection loop
1 parent 45efe56 commit 073ba53

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

game/legacy-proxy/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl Client {
440440
Connless::RequestInfo(msg::connless::RequestInfo { token: tokens[0] }),
441441
);
442442
let start_time = time.now();
443-
let mut last_req = start_time;
443+
let mut last_req = None;
444444
let mut last_reconnect = start_time;
445445
while server_info.is_none()
446446
&& !is_finished_thread.load(std::sync::atomic::Ordering::SeqCst)
@@ -514,8 +514,12 @@ impl Client {
514514

515515
let cur_time = time.now();
516516
// send new request
517-
if cur_time.saturating_sub(last_req) > Duration::from_secs(5) {
518-
log.log("Sending new info request after 5s timeout");
517+
if last_req.is_none_or(|last_req| {
518+
cur_time.saturating_sub(last_req) > Duration::from_secs(1)
519+
}) {
520+
if last_req.is_some() {
521+
log.log("Sending new info request after 1s timeout");
522+
}
519523
let token = rand::rng().next_u32() as u8;
520524
conless.sendc(
521525
addr,
@@ -524,7 +528,7 @@ impl Client {
524528

525529
tokens.push(token);
526530

527-
last_req = cur_time;
531+
last_req = Some(cur_time);
528532
}
529533

530534
// try to reconnect

0 commit comments

Comments
 (0)