about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2002-12-17 11:46:54 +0000
committerAlexander Barton <alex@barton.de>2002-12-17 11:46:54 +0000
commit902ad91212f3d756fa898239108128d2230bdc0c (patch)
tree8dc7065e312101e65936fe1866c9e6615d86df7e /src
parentca584143c6220372a19107948725d8e42cf79b21 (diff)
downloadngircd-902ad91212f3d756fa898239108128d2230bdc0c.tar.gz
ngircd-902ad91212f3d756fa898239108128d2230bdc0c.zip
- new allocated connection structures will be initialized correctly now.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 38a7dd52..ce245a98 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.104 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.105 2002/12/17 11:46:54 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -153,7 +153,7 @@ Conn_Init( VOID )
 		Log( LOG_EMERG, "Can't allocate memory! [Conn_Init]" );
 		exit( 1 );
 	}
-	Log( LOG_DEBUG, "Allocted connection pool for %ld items.", Pool_Size );
+	Log( LOG_DEBUG, "Allocted connection pool for %ld items (%ld bytes).", Pool_Size, sizeof( CONNECTION ) * Pool_Size );
 
 	/* zu Beginn haben wir keine Verbindungen */
 	FD_ZERO( &My_Listeners );
@@ -1189,11 +1189,18 @@ New_Connection( INT Sock )
 			/* Struktur umkopieren ... */
 			memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size );
 			
-			Log( LOG_DEBUG, "Allocated new connection pool for %ld items. [malloc()/memcpy()]", new_size );
+			Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size );
 		}
-		else Log( LOG_DEBUG, "Allocated new connection pool for %ld items. [realloc()]", new_size );
+		else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size );
 		
+		/* Adjust pointer to new block */
 		My_Connections = ptr;
+		
+		/* Initialize new items */
+		for( idx = Pool_Size; idx < new_size; idx++ ) Init_Conn_Struct( idx );
+		idx = Pool_Size;
+		
+		/* Adjust new pool size */
 		Pool_Size = new_size;
 	}