- Stop trying to find more adapters if it failed to avoid spamming the debug log

- Should fix buildbot test 2nd stage

svn path=/trunk/; revision=42491
This commit is contained in:
Cameron Gutman 2009-08-08 03:18:41 +00:00
parent 7b56dfa270
commit c319a3c9bb
3 changed files with 13 additions and 4 deletions

View file

@ -229,12 +229,13 @@ InterfaceConnected(MIB_IFROW IfEntry)
/* /*
* XXX Figure out the way to bind a specific adapter to a socket. * 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)); PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE));
DWORD Error, Size = sizeof(MIB_IFTABLE); DWORD Error, Size = sizeof(MIB_IFTABLE);
PDHCP_ADAPTER Adapter = NULL; PDHCP_ADAPTER Adapter = NULL;
struct interface_info *ifi = NULL; struct interface_info *ifi = NULL;
int i; int i;
BOOLEAN ret = TRUE;
DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n")); DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n"));
@ -245,7 +246,10 @@ void AdapterDiscover() {
Table = (PMIB_IFTABLE) malloc( Size ); 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)); DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries));
@ -335,6 +339,7 @@ void AdapterDiscover() {
term: term:
if( Table ) free( Table ); if( Table ) free( Table );
return ret;
} }
void AdapterStop() { void AdapterStop() {

View file

@ -77,7 +77,10 @@ dispatch(void)
* a timeout registered, time out the select call then. * a timeout registered, time out the select call then.
*/ */
another: another:
AdapterDiscover(); if (!AdapterDiscover()) {
AdapterStop();
break;
}
for (l = protocols, nfds = 0; l; l = l->next) for (l = protocols, nfds = 0; l; l = l->next)
nfds++; nfds++;

View file

@ -73,7 +73,8 @@ typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply );
#define srandom srand #define srandom srand
void AdapterInit(VOID); void AdapterInit(VOID);
void AdapterDiscover(VOID); BOOLEAN AdapterDiscover(VOID);
void AdapterStop(VOID);
HANDLE PipeInit(VOID); HANDLE PipeInit(VOID);
extern PDHCP_ADAPTER AdapterGetFirst(); extern PDHCP_ADAPTER AdapterGetFirst();
extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER);