[NeoStats-Devel] [Commits] r2852 - in trunk: include modules/dbm/gdbm modules/statserv src
[email protected] Fri, 30 Sep 2005 07:11:09 +1000
| Newsgroups | gmane.comp.neostats.devel |
|---|---|
| Message-ID | <[email protected]> |
Author: Mark
Date: Fri Sep 30 05:11:06 2005
New Revision: 2852
Modified:
trunk/include/neostats.h
trunk/modules/dbm/gdbm/gdbm.c
trunk/modules/statserv/channel.c
trunk/modules/statserv/network.c
trunk/modules/statserv/server.c
trunk/modules/statserv/statserv.c
trunk/modules/statserv/tld.c
trunk/modules/statserv/version.c
trunk/src/nsdba.c
Log:
keep statserv tables open at all times
Modified: trunk/include/neostats.h
==============================================================================
--- trunk/include/neostats.h (original)
+++ trunk/include/neostats.h Fri Sep 30 05:11:06 2005
@@ -1464,12 +1464,12 @@
EXPORTFUNC int DBADelete( const char *table, const char * key );
EXPORTFUNC int DBAFetchRows( const char *table, DBRowHandler handler );
/* DB API Macros to wrap common types */
-#define DBAStoreBool( table, key, data ) DBAStore( table, key, ( void* )data, sizeof ( int ) )
-#define DBAStoreInt( table, key, data ) DBAStore( table, key, ( void* )data, sizeof ( int ) )
-#define DBAStoreStr( table, key, data, size ) DBAStore( table, key, ( void* )data, size)
-#define DBAFetchBool( table, key, data ) DBAFetch( table, key, ( void* )data, sizeof ( int ) )
-#define DBAFetchInt( table, key, data ) DBAFetch( table, key, ( void* )data, sizeof ( int ) )
-#define DBAFetchStr( table, key, data, size ) DBAFetch( table, key, ( void* )data, size)
+#define DBAStoreBool( table, key, data ) DBAStore( table, key, ( void * )data, sizeof ( int ) )
+#define DBAStoreInt( table, key, data ) DBAStore( table, key, ( void * )data, sizeof ( int ) )
+#define DBAStoreStr( table, key, data, size ) DBAStore( table, key, ( void * )data, size)
+#define DBAFetchBool( table, key, data ) DBAFetch( table, key, ( void * )data, sizeof ( int ) )
+#define DBAFetchInt( table, key, data ) DBAFetch( table, key, ( void * )data, sizeof ( int ) )
+#define DBAFetchStr( table, key, data, size ) DBAFetch( table, key, ( void * )data, size)
/* DB API Macros to wrap common config types */
#define DBAStoreConfigBool( key, data ) DBAStoreBool(CONFIG_TABLE_NAME, key, data)
#define DBAStoreConfigInt( key, data ) DBAStoreInt(CONFIG_TABLE_NAME, key, data)
Modified: trunk/modules/dbm/gdbm/gdbm.c
==============================================================================
--- trunk/modules/dbm/gdbm/gdbm.c (original)
+++ trunk/modules/dbm/gdbm/gdbm.c Fri Sep 30 05:11:06 2005
@@ -35,7 +35,7 @@
gdbm_file_info *gdbm_file;
int cache_size = DEFAULT_CACHESIZE;
- dlog( DEBUG4, "DBMOpenTable" );
+ dlog( DEBUG4, "DBMOpenTable %s", name );
ircsprintf( filename, "%s.gdbm", name );
gdbm_file = gdbm_open( filename, 0, GDBM_WRCREAT | GDBM_NOLOCK, 00664, NULL );
if( gdbm_file == NULL )
@@ -75,7 +75,7 @@
free( dbdata.dptr );
return NS_SUCCESS;
}
- dlog( DEBUG1, "gdbm_fetch fail: %s %s", key, gdbm_strerror( gdbm_errno ) );
+ dlog( DEBUG1, "DBMGetData: gdbm_fetch fail: %s %s", key, gdbm_strerror( gdbm_errno ) );
return NS_FAILURE;
}
@@ -90,7 +90,7 @@
dbdata.dsize = size;
if( gdbm_store( ( gdbm_file_info * )handle, dbkey, dbdata, GDBM_REPLACE ) != 0 )
{
- dlog( DEBUG1, "gdbm_store fail: %s %s", key, gdbm_strerror( gdbm_errno ) );
+ dlog( DEBUG1, "DBMSetData: gdbm_store fail: %s %s", key, gdbm_strerror( gdbm_errno ) );
return NS_FAILURE;
}
return NS_SUCCESS;
Modified: trunk/modules/statserv/channel.c
==============================================================================
--- trunk/modules/statserv/channel.c (original)
+++ trunk/modules/statserv/channel.c Fri Sep 30 05:11:06 2005
@@ -731,6 +731,7 @@
nlog( LOG_CRITICAL, "Unable to create channel stat list" );
return NS_FAILURE;
}
+ DBAOpenTable( CHANNEL_TABLE );
ProcessChannelList( AddChannel, NULL );
return NS_SUCCESS;
}
@@ -750,6 +751,7 @@
channelstat *cs;
SaveChanStats();
+ DBACloseTable( CHANNEL_TABLE );
ln = list_first( channelstatlist );
while( ln )
{
Modified: trunk/modules/statserv/network.c
==============================================================================
--- trunk/modules/statserv/network.c (original)
+++ trunk/modules/statserv/network.c Fri Sep 30 05:11:06 2005
@@ -329,6 +329,7 @@
void InitNetworkStats( void )
{
+ DBAOpenTable( NETWORK_TABLE );
LoadNetworkStats();
}
@@ -343,5 +344,6 @@
void FiniNetworkStats( void )
{
+ DBACloseTable( NETWORK_TABLE );
SaveNetworkStats();
}
Modified: trunk/modules/statserv/server.c
==============================================================================
--- trunk/modules/statserv/server.c (original)
+++ trunk/modules/statserv/server.c Fri Sep 30 05:11:06 2005
@@ -725,6 +725,7 @@
nlog( LOG_CRITICAL, "Unable to create server hash list" );
return NS_FAILURE;
}
+ DBAOpenTable( SERVER_TABLE );
DBAFetchRows( SERVER_TABLE, LoadServerStats );
ProcessServerList( AddServerStat, NULL );
return NS_SUCCESS;
@@ -746,6 +747,7 @@
hscan_t hs;
SaveServerStats();
+ DBACloseTable( SERVER_TABLE );
hash_scan_begin( &hs, serverstathash );
while( ( sn = hash_scan_next( &hs ) ) )
{
Modified: trunk/modules/statserv/statserv.c
==============================================================================
--- trunk/modules/statserv/statserv.c (original)
+++ trunk/modules/statserv/statserv.c Fri Sep 30 05:11:06 2005
@@ -200,8 +200,6 @@
int ModSynch( void )
{
SET_SEGV_LOCATION();
- /* RTA init must be in synch since core does not start
- RTA during the init cycle when NeoStats first boots */
ss_bot = AddBot( &ss_botinfo );
if( !ss_bot )
return NS_FAILURE;
Modified: trunk/modules/statserv/tld.c
==============================================================================
--- trunk/modules/statserv/tld.c (original)
+++ trunk/modules/statserv/tld.c Fri Sep 30 05:11:06 2005
@@ -370,6 +370,7 @@
ircsnprintf( t->tld, 5, UNKNOWN_COUNTRY_CODE );
strlcpy( t->country, "Unknown", 8 );
lnode_create_append( tldstatlist, t );
+ DBAOpenTable( TLD_TABLE );
LoadTLDStats();
return NS_SUCCESS;
}
@@ -386,6 +387,7 @@
void FiniTLDStatistics( void )
{
SaveTLDStats();
+ DBACloseTable( TLD_TABLE );
if( gi )
{
GeoIP_delete( gi );
Modified: trunk/modules/statserv/version.c
==============================================================================
--- trunk/modules/statserv/version.c (original)
+++ trunk/modules/statserv/version.c Fri Sep 30 05:11:06 2005
@@ -258,6 +258,7 @@
nlog( LOG_CRITICAL, "Unable to create version stat list" );
return NS_FAILURE;
}
+ DBAOpenTable( CTCPVERSION_TABLE );
LoadVersionStats();
return NS_SUCCESS;
}
@@ -274,5 +275,6 @@
void FiniVersionStats( void )
{
SaveClientVersions();
+ DBACloseTable( CTCPVERSION_TABLE );
list_destroy_auto( ctcp_version_list );
}
Modified: trunk/src/nsdba.c
==============================================================================
--- trunk/src/nsdba.c (original)
+++ trunk/src/nsdba.c Fri Sep 30 05:11:06 2005
@@ -36,7 +36,6 @@
typedef struct tableentry {
char name[MAXPATH];
- char table[MAXPATH];
void *handle;
} tableentry;
@@ -256,7 +255,6 @@
return NS_FAILURE;
}
tbe = ns_calloc( sizeof( tableentry ) );
- strlcpy( tbe->table, table, MAX_MOD_NAME );
ircsnprintf( tbe->name, MAXPATH, "data/%s%s", GET_CUR_MODNAME(), table ? table : "" );
if( hnode_find( dbe->tablehash, tbe->name ) )
{