[NeoStats-Devel] [Commits] r2691 - trunk/src

[email protected] Tue, 9 Aug 2005 16:16:55 +1000
Newsgroups gmane.comp.neostats.devel
Message-ID <[email protected]>
Author: Fish
Date: Tue Aug  9 14:16:50 2005
New Revision: 2691

Modified:
   trunk/src/modules.c
   trunk/src/perl.c
Log:
Ok DNB, loading perl modules via IRC now works correctly, and shutdown errors fixed due to unreferences chars

Modified: trunk/src/modules.c
==============================================================================
--- trunk/src/modules.c	(original)
+++ trunk/src/modules.c	Tue Aug  9 14:16:50 2005
@@ -101,13 +101,13 @@
 		module_ptr->synched = 1;
 #ifdef USE_PERL
 	} else {
-		perl_sync_module(module_ptr);
+		err = perl_sync_module(module_ptr);
 	}
 #endif
 	return err;
 }
 	
-/** @brief SynchModule 
+/** @brief SynchAllModule 
  *
  * 
  *
@@ -533,6 +533,7 @@
 	 */
 	dlog(DEBUG1, "Deleting Module %s from Hash", modname);
 	hash_delete (modulehash, modnode);		
+	hnode_destroy (modnode);
 
 	/* now determine if its perl, or standard module */
 	if (IS_STD_MOD(mod_ptr)) {
@@ -553,7 +554,6 @@
 	 * can still send messages during ModFini 
 	 */
 	DelModuleBots (mod_ptr);
-	hnode_destroy (modnode);
 	/* Close module */
 	irc_globops (NULL, _("%s Module unloaded"), modname);
 	SET_RUN_LEVEL(mod_ptr);
@@ -566,9 +566,11 @@
 	SendAllModuleEvent(EVENT_MODULEUNLOAD, cmdparams);
 	ns_free(cmdparams);
 	RESET_RUN_LEVEL();
-#ifndef VALGRIND
+
 	SET_RUN_LEVEL(mod_ptr);
 	DBACloseDatabase ();
+
+
 	if (IS_STD_MOD(mod_ptr)) {
 		ns_dlclose (mod_ptr->handle);
 #ifdef USE_PERL
@@ -577,7 +579,6 @@
 #endif
 	}
 	RESET_RUN_LEVEL();
-#endif
 	ns_free (mod_ptr);
 	/* free the module number */
 	if (moduleindex >= 0) {

Modified: trunk/src/perl.c
==============================================================================
--- trunk/src/perl.c	(original)
+++ trunk/src/perl.c	Tue Aug  9 14:16:50 2005
@@ -417,9 +417,9 @@
 			nlog(LOG_WARNING, "Current Mod Stack for Perl Mods is screwed");
 			XSRETURN_EMPTY;
 		}
-		mod->info->name = SvPV_nolen (ST (0));
-		mod->info->version = SvPV_nolen (ST (1));
-		mod->info->description = SvPV_nolen (ST (2));
+		mod->info->name = strndup(SvPV_nolen (ST (0)), sv_len(ST (0)));
+		mod->info->version = strndup(SvPV_nolen (ST (1)), sv_len(ST (1)));
+		mod->info->description = strndup(SvPV_nolen (ST (2)), sv_len(ST(2)));
 
 		XSRETURN_UV (PTR2UV (mod));
 
@@ -1555,6 +1555,11 @@
 	RESET_RUN_LEVEL();
 	insert_module(mod);
 
+
+	if (IsNeoStatsSynched()) {
+		SynchModule(mod);
+	}		
+
 	cmd = ns_calloc (sizeof(CmdParams));
 	cmd->param = (char*)mod->info->name;
 	SendAllModuleEvent(EVENT_MODULELOAD, cmd);
@@ -1580,7 +1585,7 @@
 void unload_perlmod(Module *mod) {
 		PERL_SET_CONTEXT((PMI *)mod->pm->my_perl);
 		/* because segv handler doesn't handle perl well yet */
-		RESET_RUN_LEVEL()
+//		RESET_RUN_LEVEL()
 		PL_perl_destruct_level = 1;
 		perl_destruct ((PMI *)mod->pm->my_perl);