changeset 31994:2b209fa9c48d

Do not check a condition that can never be false and move its comment to the real check.
author reimar
date Wed, 08 Sep 2010 17:59:07 +0000
parents b429f2102412
children 2868b79aa4c5
files udp_sync.c
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/udp_sync.c	Wed Sep 08 17:55:35 2010 +0000
+++ b/udp_sync.c	Wed Sep 08 17:59:07 2010 +0000
@@ -106,6 +106,7 @@
     chars_received = recvfrom(sockfd, mesg, sizeof(mesg)-1, 0,
                               (struct sockaddr *)&cliaddr, &len);
 
+    // UDP wait error, probably a timeout.  Safe to ignore.
     if (chars_received == -1)
         return 0;
 
@@ -125,7 +126,6 @@
             return 1;
     }
 
-    if (chars_received > -1) {
         mesg[chars_received] = 0;
 
         if (strcmp(mesg, "bye") == 0) {
@@ -134,9 +134,6 @@
             sscanf(mesg, "%f", master_position);
             return 0;
         }
-    } else {
-        // UDP wait error, probably a timeout.  Safe to ignore.
-    }
 
     return 0;
 }