changeset 32011:bf0574ca5c57

Simply parse all received packets even if we might overwrite the values just afterwards. The speed difference should not matter and the code is much simpler.
author reimar
date Wed, 08 Sep 2010 18:54:04 +0000
parents 120953a1fc50
children cc222c24104f
files udp_sync.c
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/udp_sync.c	Wed Sep 08 18:49:57 2010 +0000
+++ b/udp_sync.c	Wed Sep 08 18:54:04 2010 +0000
@@ -113,17 +113,9 @@
         mesg[chars_received] = 0;
         if (strcmp(mesg, "bye") == 0)
             return 1;
+        sscanf(mesg, "%f", master_position);
     }
 
-    // UDP wait error, probably a timeout.  Safe to ignore.
-    if (chars_received == -1)
-        return 0;
-
-    // make sure we at least do not crash in case a
-    // failed recvfrom has corrupted the buffer
-    mesg[chars_received] = 0;
-
-    sscanf(mesg, "%f", master_position);
     return 0;
 }