about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn.c39
-rw-r--r--src/ngircd/conn.h5
2 files changed, 42 insertions, 2 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 818be9d6..85a9966b 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conn.c,v 1.92 2002/11/22 16:35:19 alex Exp $
+ * $Id: conn.c,v 1.93 2002/11/22 17:58:19 alex Exp $
  *
  * connect.h: Verwaltung aller Netz-Verbindungen ("connections")
  */
@@ -187,6 +187,43 @@ Conn_Exit( VOID )
 } /* Conn_Exit */
 
 
+GLOBAL INT
+Conn_InitListeners( VOID )
+{
+	/* Ports, auf denen der Server Verbindungen entgegennehmen
+	* soll, initialisieren */
+
+	INT created, i;
+
+	created = 0;
+	for( i = 0; i < Conf_ListenPorts_Count; i++ )
+	{
+		if( Conn_NewListener( Conf_ListenPorts[i] )) created++;
+		else Log( LOG_ERR, "Can't listen on port %u!", Conf_ListenPorts[i] );
+	}
+	return created;
+} /* Conn_InitListeners */
+
+
+GLOBAL VOID
+Conn_ExitListeners( VOID )
+{
+	/* Alle "Listen-Sockets" schliessen */
+
+	INT i;
+
+	Log( LOG_INFO, "Shutting down all listening sockets ..." );
+	for( i = 0; i < Conn_MaxFD + 1; i++ )
+	{
+		if( FD_ISSET( i, &My_Sockets ) && FD_ISSET( i, &My_Listeners ))
+		{
+			close( i );
+			Log( LOG_DEBUG, "Listening socket %d closed.", i );
+		}
+	}
+} /* Conn_ExitListeners */
+
+
 GLOBAL BOOLEAN
 Conn_NewListener( CONST UINT Port )
 {
diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h
index d86fbca1..f2c61643 100644
--- a/src/ngircd/conn.h
+++ b/src/ngircd/conn.h
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conn.h,v 1.21 2002/11/05 14:18:13 alex Exp $
+ * $Id: conn.h,v 1.22 2002/11/22 17:58:19 alex Exp $
  *
  * conn.h: Verwaltung aller Netz-Verbindungen ("connections") (Header)
  */
@@ -28,6 +28,9 @@ typedef INT CONN_ID;
 GLOBAL VOID Conn_Init PARAMS((VOID ));
 GLOBAL VOID Conn_Exit PARAMS(( VOID ));
 
+GLOBAL INT Conn_InitListeners PARAMS(( VOID ));
+GLOBAL VOID Conn_ExitListeners PARAMS(( VOID ));
+
 GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port ));
 
 GLOBAL VOID Conn_Handler PARAMS(( VOID ));