mirror of
https://github.com/gopher64/gopher64.git
synced 2026-10-03 17:55:31 +02:00
Netplay fix for buffer reporting (#173)
This commit is contained in:
1 parent
5436b8c0fe
commit
dae67b7e8b
1 file changed
+2
-3
+2
-3
@@ -105,15 +105,14 @@ pub fn get_input(device: &mut device::Device, channel: usize) -> (u32, bool) {
|
||||
let mut input = None;
|
||||
|
||||
let timeout = std::time::Instant::now() + std::time::Duration::from_secs(10);
|
||||
let mut request_timer = std::time::Instant::now() + std::time::Duration::from_millis(5);
|
||||
request_input(netplay, channel);
|
||||
let mut request_timer = std::time::Instant::now() - std::time::Duration::from_millis(5);
|
||||
while input.is_none() {
|
||||
process_incoming(netplay); // we execute process_incoming before request_input so that we send an accurate buffer count
|
||||
if std::time::Instant::now() > request_timer {
|
||||
// sends a request packet every 5ms
|
||||
request_input(netplay, channel);
|
||||
request_timer = std::time::Instant::now() + std::time::Duration::from_millis(5);
|
||||
}
|
||||
process_incoming(netplay);
|
||||
input = netplay.player_data[channel]
|
||||
.input_events
|
||||
.remove(&netplay.player_data[channel].count);
|
||||
|
||||
Reference in new issue
Block a user