Browse Source

pstats: PStatClient.connect() should wait for UDP connection to be established

This makes the behavior of PStats more predictable, reducing missed frames at the beginning
rdb 3 years ago
parent
commit
93b7ebffaa
1 changed files with 5 additions and 0 deletions
  1. 5 0
      panda/src/pstatclient/pStatClientImpl.cxx

+ 5 - 0
panda/src/pstatclient/pStatClientImpl.cxx

@@ -124,6 +124,11 @@ client_connect(std::string hostname, int port) {
   MutexDebug::increment_pstats();
   MutexDebug::increment_pstats();
 #endif // DEBUG_THREADS
 #endif // DEBUG_THREADS
 
 
+  // Wait for the server hello.
+  while (!_got_udp_port) {
+    transmit_control_data();
+  }
+
   return _is_connected;
   return _is_connected;
 }
 }