- Stop trying to find more adapters if it failed to avoid spamming the debug log
authorCameron Gutman <aicommander@gmail.com>
Sat, 8 Aug 2009 03:18:41 +0000 (03:18 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 8 Aug 2009 03:18:41 +0000 (03:18 +0000)
 - Should fix buildbot test 2nd stage

svn path=/trunk/; revision=42491

reactos/base/services/dhcp/adapter.c
reactos/base/services/dhcp/dispatch.c
reactos/base/services/dhcp/include/rosdhcp.h

index 4394733..4de0d5d 100644 (file)
@@ -229,12 +229,13 @@ InterfaceConnected(MIB_IFROW IfEntry)
 /*
  * XXX Figure out the way to bind a specific adapter to a socket.
  */
-void AdapterDiscover() {
+BOOLEAN AdapterDiscover() {
     PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE));
     DWORD Error, Size = sizeof(MIB_IFTABLE);
     PDHCP_ADAPTER Adapter = NULL;
     struct interface_info *ifi = NULL;
     int i;
+    BOOLEAN ret = TRUE;
 
     DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n"));
 
@@ -245,7 +246,10 @@ void AdapterDiscover() {
         Table = (PMIB_IFTABLE) malloc( Size );
     }
 
-    if( Error != NO_ERROR ) goto term;
+    if( Error != NO_ERROR ) {
+        ret = FALSE;
+        goto term;
+    }
 
     DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries));
 
@@ -335,6 +339,7 @@ void AdapterDiscover() {
 
 term:
     if( Table ) free( Table );
+    return ret;
 }
 
 void AdapterStop() {
index 3839c20..76ac90e 100644 (file)
@@ -77,7 +77,10 @@ dispatch(void)
          * a timeout registered, time out the select call then.
          */
     another:
-        AdapterDiscover();
+        if (!AdapterDiscover()) {
+            AdapterStop();
+            break;
+        }
 
         for (l = protocols, nfds = 0; l; l = l->next)
             nfds++;
index ce24ae8..159a5ad 100644 (file)
@@ -73,7 +73,8 @@ typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply );
 #define srandom srand
 
 void AdapterInit(VOID);
-void AdapterDiscover(VOID);
+BOOLEAN AdapterDiscover(VOID);
+void AdapterStop(VOID);
 HANDLE PipeInit(VOID);
 extern PDHCP_ADAPTER AdapterGetFirst();
 extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER);