use io_close instead of plain close in Conn_ExitListeners()

This commit is contained in:
Florian Westphal 2005-09-24 02:20:00 +00:00
parent 5b2364b236
commit e9f3e69f36
1 changed files with 9 additions and 10 deletions

View File

@ -17,7 +17,7 @@
#include "portab.h" #include "portab.h"
#include "io.h" #include "io.h"
static char UNUSED id[] = "$Id: conn.c,v 1.181 2005/09/12 19:10:20 fw Exp $"; static char UNUSED id[] = "$Id: conn.c,v 1.182 2005/09/24 02:20:00 fw Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -320,23 +320,22 @@ Conn_ExitListeners( void )
{ {
/* Close down all listening sockets */ /* Close down all listening sockets */
int *fd; int *fd;
unsigned int arraylen; size_t arraylen;
#ifdef ZEROCONF #ifdef ZEROCONF
Rendezvous_UnregisterListeners( ); Rendezvous_UnregisterListeners( );
#endif #endif
arraylen = array_length(&My_Listeners, sizeof (int)); arraylen = array_length(&My_Listeners, sizeof (int));
Log( LOG_INFO, "Shutting down all listening sockets (%d)...", arraylen ); Log( LOG_INFO, "Shutting down all listening sockets (%d total)...", arraylen );
fd = array_start(&My_Listeners);
while(arraylen--) { while(arraylen--) {
fd = (int*) array_get(&My_Listeners, sizeof (int), arraylen); assert(fd);
if (fd) { assert(*fd >= 0);
close(*fd); io_close(*fd);
#ifdef DEBUG #ifdef DEBUG
Log( LOG_DEBUG, "Listening socket %d closed.", *fd ); Log( LOG_DEBUG, "Listening socket %d closed.", *fd );
} else {
Log( LOG_DEBUG, "array_get pos %d returned NULL", arraylen );
#endif #endif
} fd++;
} }
array_free(&My_Listeners); array_free(&My_Listeners);
} /* Conn_ExitListeners */ } /* Conn_ExitListeners */