@@ -347,6 +347,8 @@ struct Client {
347347 log : ConnectingLog ,
348348
349349 last_snapshot : Snapshot ,
350+
351+ start_time : Duration ,
350352}
351353
352354impl Client {
@@ -356,6 +358,7 @@ impl Client {
356358 addr : SocketAddr ,
357359 log : ConnectingLog ,
358360 ) -> anyhow:: Result < LegacyProxy > {
361+ let proxy_start = time. now ( ) ;
359362 let fs = io. fs . clone ( ) ;
360363
361364 log. log ( "Preparing proxy socket" ) ;
@@ -675,6 +678,8 @@ impl Client {
675678 is_finished : is_finished_thread,
676679
677680 log,
681+
682+ start_time : proxy_start,
678683 } ;
679684
680685 app. run_loop ( ) . unwrap ( ) ;
@@ -3528,13 +3533,7 @@ impl Client {
35283533
35293534 self . players . insert (
35303535 self . base . id_generator . next_id ( ) ,
3531- ProxyClient :: new (
3532- Default :: default ( ) ,
3533- sock_loop,
3534- self . time . now ( ) ,
3535- 0 ,
3536- false ,
3537- ) ,
3536+ ProxyClient :: new ( Default :: default ( ) , sock_loop, 0 , false ) ,
35383537 ) ;
35393538 }
35403539 }
@@ -3564,13 +3563,7 @@ impl Client {
35643563
35653564 self . players . insert (
35663565 self . base . id_generator . next_id ( ) ,
3567- ProxyClient :: new (
3568- Default :: default ( ) ,
3569- sock_loop,
3570- self . time . now ( ) ,
3571- 0 ,
3572- false ,
3573- ) ,
3566+ ProxyClient :: new ( Default :: default ( ) , sock_loop, 0 , false ) ,
35743567 ) ;
35753568 }
35763569 ClientToServerMessage :: Ready ( msg) => {
@@ -3619,13 +3612,7 @@ impl Client {
36193612 let player_id = self . base . id_generator . next_id ( ) ;
36203613 self . players . insert (
36213614 player_id,
3622- ProxyClient :: new (
3623- ev. player_info ,
3624- sock_loop,
3625- self . time . now ( ) ,
3626- ev. id ,
3627- true ,
3628- ) ,
3615+ ProxyClient :: new ( ev. player_info , sock_loop, ev. id , true ) ,
36293616 ) ;
36303617 if let Some ( con_id) = self . con_id {
36313618 self . server_network . send_unordered_to (
@@ -4531,10 +4518,9 @@ impl Client {
45314518 self . server_network . send_unordered_to (
45324519 & ServerToClientMessage :: ServerInfo {
45334520 info : server_info,
4534- overhead : self
4535- . time
4536- . now ( )
4537- . saturating_sub ( player. data . connect_time ) ,
4521+ // the proxy is not really good at estimating the first ping
4522+ // so give it the whole startup time as overhead instead
4523+ overhead : self . time . now ( ) . saturating_sub ( self . start_time ) ,
45384524 } ,
45394525 & con_id,
45404526 ) ;
0 commit comments