From a02bf31d50743df9196310f4261fc09964347fbc Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Wed, 18 Dec 2002 13:50:22 +0000 Subject: [PATCH] - new functions Conn_ResetWCounter() and Conn_WCounter(). --- src/ngircd/conn.c | 24 ++++++++++++++++++++++-- src/ngircd/conn.h | 5 ++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index ce245a98..bc2ccbdc 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.105 2002/12/17 11:46:54 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.106 2002/12/18 13:50:22 alex Exp $"; #include "imp.h" #include @@ -129,7 +129,7 @@ LOCAL fd_set My_Sockets; LOCAL fd_set My_Connects; LOCAL CONNECTION *My_Connections; -LOCAL LONG Pool_Size; +LOCAL LONG Pool_Size, WCounter; GLOBAL VOID @@ -165,6 +165,9 @@ Conn_Init( VOID ) /* Connection-Struktur initialisieren */ for( i = 0; i < Pool_Size; i++ ) Init_Conn_Struct( i ); + + /* Global write counter */ + WCounter = 0; } /* Conn_Init */ @@ -548,6 +551,9 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) My_Connections[Idx].bytes_out += Len; } + /* Adjust global write counter */ + WCounter += Len; + return TRUE; } /* Conn_Write */ @@ -967,6 +973,20 @@ Conn_RecvBytes( CONN_ID Idx ) } /* Conn_RecvBytes */ +GLOBAL VOID +Conn_ResetWCounter( VOID ) +{ + WCounter = 0; +} /* Conn_ResetWCounter */ + + +GLOBAL LONG +Conn_WCounter( VOID ) +{ + return WCounter; +} /* Conn_WCounter */ + + LOCAL BOOLEAN Try_Write( CONN_ID Idx ) { diff --git a/src/ngircd/conn.h b/src/ngircd/conn.h index f553277d..b9812156 100644 --- a/src/ngircd/conn.h +++ b/src/ngircd/conn.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conn.h,v 1.25 2002/12/12 12:23:43 alex Exp $ + * $Id: conn.h,v 1.26 2002/12/18 13:50:22 alex Exp $ * * Connection management (header) */ @@ -77,6 +77,9 @@ GLOBAL LONG Conn_SendBytesZip PARAMS(( CONN_ID Idx )); GLOBAL LONG Conn_RecvBytesZip PARAMS(( CONN_ID Idx )); #endif +GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID )); +GLOBAL LONG Conn_WCounter PARAMS(( VOID )); + GLOBAL INT Conn_MaxFD;