Fixing error reporting
[tpg/acess2.git] / Modules / IPStack / icmp.c
index 77bc691..9f67175 100644 (file)
@@ -111,7 +111,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr)
                {
                        if(gICMP_PingSlots[i].Interface == NULL)        break;
                }
-               if(gICMP_PingSlots[i].Interface == NULL)        break;
+               if( i < PING_SLOTS )    break;
                Threads_Yield();
        }
        gICMP_PingSlots[i].Interface = Interface;
@@ -125,8 +125,7 @@ int ICMP_Ping(tInterface *Interface, tIPv4 Addr)
        end = ts + Interface->TimeoutDelay;
        while( !gICMP_PingSlots[i].bArrived && now() < end)     Threads_Yield();
        
-       ts = now() - ts;
-       if(ts > Interface->TimeoutDelay)
+       if(now() > end)
                return -1;
        
        return (int)ts;

UCC git Repository :: git.ucc.asn.au