Пример #1
0
void proxenet_destroy_plugins_vm() 
{
	plugin_t *p;
	
	for (p=plugins_list; p!=NULL; p=p->next) {
		
		switch (p->type) {
#ifdef _PYTHON_PLUGIN      
			case _PYTHON_: 
				proxenet_python_destroy_vm(p);
				break;
#endif
				
#ifdef _C_PLUGIN
			case _C_:
				proxenet_c_destroy_vm(p);
				break;
#endif

#ifdef _RUBY_PLUGIN
			case _RUBY_:
				proxenet_ruby_destroy_vm(p);
				break;
#endif

#ifdef _PERL_PLUGIN
			case _PERL_:
				proxenet_perl_destroy_vm(p);
				break;
#endif				

#ifdef _LUA_PLUGIN
			case _LUA_:
				proxenet_lua_destroy_vm(p);
				break;
#endif				
				
			default:
				break;
				
		}
	}
}
Пример #2
0
/**
 * Disable plugins and kill all the interpreters allocated in a clean (i.e. API-provided) way.
 *
 * Caller must make sure proxenet is in safe state (child threads are joined) before calling
 * this function.
 */
void proxenet_destroy_plugins_vm()
{
        plugin_t *p;
        interpreter_t *vm;

        for (p=plugins_list; p!=NULL; p=p->next) {

                vm = NULL;

                if (!p->interpreter->ready)
                        continue;

                /*
                 * The function `proxenet_*_destroy_plugin()` must set the current plugin as
                 * INACTIVE, remove all the active references and clear allocated blocks.
                 */
                switch (p->type) {
#ifdef _PYTHON_PLUGIN
                        case _PYTHON_:   proxenet_python_destroy_plugin(p); break;
#endif
#ifdef _C_PLUGIN
                        case _C_:        proxenet_c_destroy_plugin(p); break;
#endif
#ifdef _RUBY_PLUGIN
                        case _RUBY_:     proxenet_ruby_destroy_plugin(p); break;
#endif
#ifdef _PERL_PLUGIN
                        case _PERL_:     proxenet_perl_destroy_plugin(p); break;
#endif
#ifdef _LUA_PLUGIN
                        case _LUA_:      proxenet_lua_destroy_plugin(p); break;
#endif
#ifdef _TCL_PLUGIN
                        case _TCL_:      proxenet_tcl_destroy_plugin(p); break;
#endif
#ifdef _JAVA_PLUGIN
                        case _JAVA_:     proxenet_java_destroy_plugin(p); break;
#endif
                        default: break;
                }
                if(cfg->verbose)
                        xlog(LOG_INFO, "Plugin '%s' has been destroyed.\n", p->name);

                if (count_initialized_plugins_by_type(p->type) > 0)
                        continue;

                vm = p->interpreter;

                /*
                 * The function `proxenet_*_destroy_vm()` calls API to delete the VM. The function
                 * is called when the last plugin[type] has been destroyed
                 */
                switch (p->type) {
#ifdef _PYTHON_PLUGIN
                        case _PYTHON_:   proxenet_python_destroy_vm(vm); break;
#endif
#ifdef _C_PLUGIN
                        case _C_:        proxenet_c_destroy_vm(vm); break;
#endif
#ifdef _RUBY_PLUGIN
                        case _RUBY_:     proxenet_ruby_destroy_vm(vm); break;
#endif
#ifdef _PERL_PLUGIN
                        case _PERL_:     proxenet_perl_destroy_vm(vm); break;
#endif
#ifdef _LUA_PLUGIN
                        case _LUA_:      proxenet_lua_destroy_vm(vm); break;
#endif
#ifdef _TCL_PLUGIN
                        case _TCL_:      proxenet_tcl_destroy_vm(vm); break;
#endif
#ifdef _JAVA_PLUGIN
                        case _JAVA_:     proxenet_java_destroy_vm(vm); break;
#endif
                        default: break;
                }

                if(cfg->verbose)
                        xlog(LOG_INFO, "VM %s has been destroyed.\n", supported_plugins_str[p->type]);
        }

        return;
}