Fixed GUI font rendering
[tpg/acess2.git] / Modules / IPStack / arp.c
index 476557e..35532f6 100644 (file)
@@ -73,6 +73,7 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address)
         int    lastID;
         int    i;
        struct sArpRequest4     req;
+       Sint64  timeout;
        
        ENTER("pInterface xAddress", Interface, Address);
        
@@ -129,10 +130,16 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address)
        // Send Request
        Link_SendPacket(Interface->Adapter, 0x0806, req.DestMac, sizeof(struct sArpRequest4), &req);
        
+       timeout = now() + Interface->TimeoutDelay;
+       
        // Wait for a reply
        for(;;)
        {
-               while(lastID == giARP_LastUpdateID)     Threads_Yield();
+               while(lastID == giARP_LastUpdateID && now() < timeout)
+                       Threads_Yield();
+               
+               if( now() >= timeout )  break;  // Timeout
+               
                lastID = giARP_LastUpdateID;
                
                Mutex_Acquire( &glARP_Cache4 );
@@ -145,6 +152,10 @@ tMacAddr ARP_Resolve4(tInterface *Interface, tIPv4 Address)
                }
                Mutex_Release( &glARP_Cache4 );
        }
+       {
+               tMacAddr        ret = {{0,0,0,0,0,0}};
+               return ret;
+       }
 }
 
 /**

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