Example #1
0
bool cutFlowHandler::mask()
{
	for(TMapiP2cc::iterator ii=list->begin() ; ii!=list->end() ; ++ii)
	{
		int num    = ii->first;
		string str = (string)ii->second;
		_INFO("["+tostring(num)+"]="+str);
		
		if(str=="obj")
		{
			if(Next(ii)=="NAME")    name    = Next(ii); else {_ERROR("obj: failed to read NAME->"+PreviousStay(ii)); return false;}
			if(Next(ii)=="FLAG")    flag    = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read FLAG->"+PreviousStay(ii)); return false;}
			if(Next(ii)=="order")   order   = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read order->"+PreviousStay(ii)); return false;}
			if(Next(ii)=="phase")   phase   = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read phase->"+PreviousStay(ii)); return false;}
			if(Next(ii)=="skip")    skip    = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read skip->"+PreviousStay(ii)); return false;}
			if(Next(ii)=="nparameters") nparameters = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read nparameters->"+PreviousStay(ii)); return false;}
			_INFO("NAME="+name+", FLAG="+flag+", order="+order+", phase="+phase+", skip="+skip+", nparameters="+nparameters);

			if(Next(ii)=="parameters")
			{
				vdtmp.clear();
				for(int v=1 ; v<=validate_int(nparameters) ; ++v)
				{
					if(Next(ii)=="parameter") /* do nothing*/
					if(Next(ii)=="NAME")  attrname  = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read NAME->"+PreviousStay(ii)); return false;}
					if(Next(ii)=="ORDER") attrorder = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read ORDER->"+PreviousStay(ii)); return false;}
					if(Next(ii)=="TYPE")  attrtype  = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read TYPE->"+PreviousStay(ii)); return false;}
					val = Next(ii);
					_INFO("\tparameter["+tostring(v)+"] NAME="+attrname+", ORDER="+attrorder+", TYPE="+attrtype+", val="+val);
					// HAVE TO CHECK THE TYPE !!!!!
					vdtmp.push_back(validate_double(val));
				}
				if((int)vdtmp.size() != validate_int(nparameters)) {_ERROR("vector size doesn't match nparameters"); return false;}
			}
			else {_ERROR("obj NAME:"+name+" -> failed to read parameters->"+PreviousStay(ii)); return false;}
			
			if(Next(ii)=="description") description = Next(ii); else {_ERROR("obj NAME:"+name+" -> failed to read description->"+PreviousStay(ii)); return false;}
			_INFO("description="+description);

			m_cutFlowOrdered->insert(     make_pair(validate_double(order),name) );
			m_cutFlowTypeOrdered->insert( make_pair(validate_double(order),phase) );
			m_cutFlowNumbers->insert(     make_pair(name,0) );
			m_cutFlowMapSVD->insert(      make_pair(name,vdtmp) );
			m_cutsFlowSkipMap->insert(    make_pair(name,validate_bool(skip)) );
		}
	}
	return true;
}
Example #2
0
//---------------------------------------------------------------------------------
// Name: init() 
//---------------------------------------------------------------------------------
bool Game::init()
{
    m_input_mgr   = INPUT_MGR;
    m_ev_mgr      = EVENT_MGR;
    m_rnd_mgr     = RENDER_MGR;
    m_res_mgr     = RES_MGR;
    m_proc_mgr    = PROC_MGR;
    m_audio_mgr   = AUDIO_MGR;
    m_menu_mgr    = MENU_MGR;
    m_map_mgr     = MAP_MGR;
    m_battle_city = BATTLE_CITY;
    m_ai_mgr      = AI;

    m_res_mgr   ->regLoaderFunc( MAP_TYPE, MapManager::loadResMetaFromXML );
    m_res_mgr   ->regLoaderFunc( AUDIO_TYPE, AudioManager::loadResMetaFromXML );
    m_res_mgr   ->regLoaderFunc( TEXTURE_TYPE, RenderManager::loadResMetaFromXML );
    
    m_rnd_mgr   ->init();
    m_res_mgr   ->init();
    m_audio_mgr ->init();

    m_rnd_mgr   ->setWindowTitle( APP_NAME);
    m_rnd_mgr   ->setDesiredRes( BASE_SCREEN_WIDTH, BASE_SCREEN_HEIGHT );

    m_map_mgr   ->setGameLogic( m_battle_city );

    changeState( IntroState::getInstance() );

    _INFO("Game initialized");
    return true;
}
Example #3
0
void test_image_manager::test1(void)
{
    _START();
    _INFO("Verify of internal class nnImageManager: method  read configuration and load images");
    _AUTHOR("Coppi Angelo n2draw library ");
    _STOP();
    miniXmlNode  node;
#ifdef _UNICODE
    bool res = miniXmlNode::load(X("..\\..\\conf_utf16.xml"),&node);
#else
    bool res = miniXmlNode::load(X("..\\..\\conf_utf8.xml"),&node);
#endif
    CA_ASSERT(res == true);
    STRING s;
    nnImageManager im(s);
    res = im.readConfiguration(&node);
    CA_ASSERT(res == true);
    res = im.loadImages();
    CA_ASSERT(res == true);
    /*
    const listImage *images = im.getImageList();
    if (images != nullptr)
    {
        listImage::const_iterator it = images->begin();
        listImage::const_iterator _end = images->end();
        while (it != _end)
        {
            draw((it->second));
            it++;
        }
    }
    */
}
//---------------------------------------------------------------------------------
// Name: ResourceManager() (Constructor)
//---------------------------------------------------------------------------------
ResourceManager::ResourceManager()
{
    pd = new PDATA;
    
    pd->m_last_resource_id = 0;
    _INFO("Resource Manager created");
}
Example #5
0
File: mn_scene.c Project: RedFT/ECS
void SceneManager_registerApp(void *_self, App *app)
{
    if (!_self)
        return;
    SceneManager *self = _self;
    self->app = app;
    _INFO("Registered app to %s", self->manager_type);
}
Example #6
0
void    Entity_clean(void *_self)
{
    if (!_self)
        return;
    Entity *self = _self;
    g_slist_free(self->component_list);
    _INFO("Free'd Component list for: %s", self->entity_type);
}
Example #7
0
void test_bmpImage_class::test2(void)
{
    _START();
    _INFO("verifica interna alla classe: metodo create");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    CA_ASSERT(s.create(100, 100,24,  255) == true);
    CA_ASSERT((LPBITMAPFILEHEADER)s != nullptr);
}
Example #8
0
void test_bmpImage_class::test7(void)
{
    _START();
    _INFO("verifica interrna alla classe : metodo isValid()");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24, 255);
    CA_ASSERT(s.isValid()==true);
}
Example #9
0
void test_bmpImage_class::test14(void)
{
    _START();
    _INFO("verifica interrna alla classe:dimensioni");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.copyFromFile("./old/BORDER.BMP");
    s.copyToFile("BORDER.BMP");
}
//---------------------------------------------------------------------------------
// Name: loadGlobalRes()
// Desc: Loads global resources.
//---------------------------------------------------------------------------------
void ResourceManager::loadGlobalRes()
{
    std::list< Resource * >::iterator it;
    for ( it = pd->m_resources.begin(); it != pd->m_resources.end(); it++ )
    {
        if ( (*it)->isGlobal() )
            (*it)->load();
    }
    _INFO("Loaded global resources");
}
//---------------------------------------------------------------------------------
// Name: clearTemp()
// Desc: Removes temporary resources from memory.
//---------------------------------------------------------------------------------
void ResourceManager::clearTempRes()
{
    std::list< Resource * >::iterator it;
    for ( it = pd->m_resources.begin(); it != pd->m_resources.end(); it++ )
    {
        if ( !(*it)->isGlobal() && (*it)->isLoaded() )
            (*it)->unload();
    }
    _INFO("Unloaded temporary resources");
}
Example #12
0
void    Entity_registerComponent(void *_self, Component *component)
{
    if (!_self)
        return;
    Entity *self = _self;
    
    self->component_list = g_slist_append(self->component_list, component);
    REGISTER(*component, Entity, *self)
    _INFO("Added %s to %s's Component list", component->component_type, self->entity_type);
}
Example #13
0
void test_bmpImage_class::test13(void)
{
    _START();
    _INFO("verifica interrna alla classe:dimensioni");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(50, 100,24,  255);
    CA_ASSERT(s.check(50, 100)==true);
    CA_ASSERT(s.check(150, 100)==false);
}
Example #14
0
int main(int argc, char* argv[]) {
	mallopt(M_MMAP_THRESHOLD, 256*1024);
	setenv("LC_CTYPE", "zh_CN.gbk", 1);
	close(STDIN_FILENO);
	signal(SIGPIPE, SIG_IGN);
	signal(SIGTERM, &sigterm_handler);
	signal(SIGINT, &sigint_handler);

    http_handler* handler = new http_handler(4, 20);
    handler->open(10086, 10, (1 << 10) * 256);
    _INFO("ready to activate");
    handler->activate();
    _INFO("start!");
    pause();
    _INFO("stop");
	handler->stop();
    delete handler;

    return 0;
}
//---------------------------------------------------------------------------------
// Name: clearAll()
// Desc: Removes all resources from memory.
//---------------------------------------------------------------------------------
void ResourceManager::clearAll()
{
    std::list< Resource * >::iterator it;
    for ( it = pd->m_resources.begin(); it != pd->m_resources.end(); it++ )
    {
        (*it)->unload();
        SAFE_DELETE( *it );
    }
    pd->m_resources.clear();

    _INFO("Unloaded all resources");
}
Example #16
0
void test_bmpImage_class::test3(void)
{
    _START();
    _INFO("verifica interrna alla classe : verifica struttura bitmapfileheader");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24, 255);
    LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s;
    CA_ASSERT(v->bfType == 0x4d42);
    CA_ASSERT(v->bfOffBits == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER))));
    CA_ASSERT(v->bfSize == ((int)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (100 * 100 * 3))));
}
Example #17
0
void test_bmpImage_class::test9(void)
{
    _START();
    _INFO("verifica interrna alla classe:metodo detach");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24,  255);
    LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s;
    CA_ASSERT(s.detach()==true);
    CA_ASSERT((LPBITMAPFILEHEADER)(s)==nullptr);
    delete [](v);
}
Example #18
0
void test_app_manager::test1(void)
{
    _START();
    _INFO("Verify of internal class nnAppManager:load and display a draw");
    _AUTHOR("Coppi Angelo n2draw library ");
    _STOP();
    nnAppManager app;
#ifdef _UNICODE
    STRING name(X("conf_utf16.xml"));
#else
    STRING name(X("conf_utf8.xml"));
#endif
    STRING path("./");
    IChild *childs = app.createObjects(name,path);
    CA_ASSERT(childs != nullptr);
    bool res;
    nnPoint p=childs->getView()->getConstPhy();
    CA_ASSERT(p.x != 0 );
    CA_ASSERT(p.y != 0);
    res=childs->getImage()->loadImages();
    CA_ASSERT(res == true);
    nnContactNO *v = new nnContactNO();
    nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager());
    res = mn->addContact(10, 0, v);
    CA_ASSERT(res == true);
    CA_ASSERT((int)mn->size() == (int)1);
    nnGenericCoil *u = new nnGenericCoil();
    res = mn->addCoil(10, u);
    CA_ASSERT(res == true);
    CA_ASSERT((int)mn->size() == (int)20);
    nnContactNC *v1 = new nnContactNC();
    res = mn->addContact(12, 0, v1);
    CA_ASSERT(res == true);
    nnPoint p1(12, 0);
    nnPoint p2(10, 0);
    nnConnection::connectComponent(childs->getManager(), p1, p2);
    res = childs->getView()->updateDraw();
    CA_ASSERT(res == true);
    bmpImage &bdraw = childs->getView()->getDraw();
    for(unsigned int i=0;i<bdraw.getWidth();i+=100)
        bdraw.line(i,0,i,bdraw.getHeight(),255,0,0,0xfefefefe);
    for(unsigned int u=0;u<bdraw.getHeight();u+=100)
        bdraw.line(0,u,bdraw.getWidth(),u,0,0,255,0xfefefefe);
        bdraw.line(0,0,bdraw.getWidth(),bdraw.getHeight(),0,255,0,0xfefefefe);
        bdraw.line(0,0,200,bdraw.getHeight(),0,255,255,0xfefefefe);
    bdraw.frameRect(10,10,300,300,128,128,64,0xfefefefe);
    bdraw.frameRect(50,50,250,250,128,128,64,0xfefefefe);
    draw(&bdraw);
    MKDIR(".\\bmp",S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
    bdraw.copyToFile(X(".\\bmp\\test1_app.bmp"));
}
Example #19
0
void test_bmpImage_class::test1(void)
{
    _START();
    _INFO("verifica interrna alla classe: metodo attach");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    CA_ASSERT_M("Pointer to bitmapfileheader test is  null", (nullptr == (LPBITMAPFILEHEADER)s));
    LPBITMAPFILEHEADER p;
    p= (LPBITMAPFILEHEADER) new unsigned char[sizeof(BITMAPFILEHEADER)];
    CA_ASSERT_M("Test Attach method", s.attach(p) == true);
    CA_ASSERT_M("Pointer to bitmapfileheader is valid", (nullptr != (LPBITMAPFILEHEADER)s));

}
Example #20
0
void test_bmpImage_class::test12(void)
{
    _START();
    _INFO("verifica interrna alla classe:metodo landscape");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(50, 100,24,  255);
    CA_ASSERT((int)s.getWidth()==50);
    CA_ASSERT((int)s.getHeight() == 100);
    s.landscape(false);
    CA_ASSERT((int)s.getWidth()== 100);
    CA_ASSERT((int)s.getHeight()== 50);
}
Example #21
0
void test_app_manager::test2(void)
{
    _START();
    _INFO("Verify of internal class nnAppManager:load and display a draw, and scroll it");
    _AUTHOR("Coppi Angelo n2draw library ");
    _STOP();
    nnAppManager app;
#ifdef _UNICODE
    STRING name(X("conf_utf16.xml"));
#else
    STRING name(X("conf_ut8.xml"));
#endif
    STRING path("./");
    IChild *childs = app.createObjects(name,path);
    CA_ASSERT(childs != nullptr);
    bool res;

    res = childs->getImage()->loadImages();
    CA_ASSERT(res == true);
    nnContactNO *v = new nnContactNO();
    nnObjManager *mn = dynamic_cast<nnObjManager *>(childs->getManager());
    res = mn->addContact(10, 0, v);
    CA_ASSERT(res == true);
    CA_ASSERT((int)mn->size() == (int)1);
    nnGenericCoil *u = new nnGenericCoil();
    res = mn->addCoil(10, u);
    CA_ASSERT(res == true);
    CA_ASSERT((int)mn->size() == (int)20);
    nnContactNC *v1 = new nnContactNC();
    res = mn->addContact(12, 0, v1);
    CA_ASSERT(res == true);
    nnPoint p1(12, 0);
    nnPoint p2(10, 0);
    nnConnection::connectComponent(childs->getManager(), p2, p1);
    res = childs->getView()->updateDraw();
    CA_ASSERT(res == true);
    bmpImage &bdraw = childs->getView()->getDraw();
    draw(&bdraw);
    childs->getView()->handlerScrollHorz(2);
    res = childs->getView()->updateDraw();
    //CA_ASSERT(res == true);
    bdraw = childs->getView()->getDraw();
    draw(&bdraw);
    childs->getView()->handlerScrollVert(2);
    res = childs->getView()->updateDraw();
    CA_ASSERT(res == true);
    bdraw = childs->getView()->getDraw();
    draw(&bdraw);
}
Example #22
0
//---------------------------------------------------------------------------------
// Name: Game()
//---------------------------------------------------------------------------------
Game::Game()
{
    m_ev_mgr = NULL;
    m_ai_mgr = NULL;
    m_map_mgr = NULL;
    m_res_mgr = NULL;
    m_rnd_mgr = NULL;
    m_proc_mgr = NULL;
    m_menu_mgr = NULL;
    m_input_mgr = NULL;
    m_audio_mgr = NULL;
    m_battle_city = NULL;

    _INFO("Game created");
}
Example #23
0
void test_bmpImage_class::test10(void)
{
    _START();
    _INFO("verifica interrna alla classe: create attach clear");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24,  255);
    bmpImage t;
    t.create(100, 100,24, 255);
    LPBITMAPFILEHEADER v = (LPBITMAPFILEHEADER)s;
    t.clear();
    t.attach(s);
    CA_ASSERT(v == (LPBITMAPFILEHEADER)t);
}
Example #24
0
void test_bmpImage_class::test6(void)
{
    _START();
    _INFO("verifica interrna alla classe: metodo copyfrom bmpImage");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24,  255);
    bmpImage v;
    v.copyFrombmpImage(s);
    int res = memcmp((LPBITMAPFILEHEADER)s, (LPBITMAPFILEHEADER)v, ((LPBITMAPFILEHEADER)(s))->bfSize);
    CA_ASSERT(res== 0);
    draw(&v);

}
Example #25
0
void test_bmpImage_class::test4(void)
{
    _START();
    _INFO("verifica interrna alla classe : struttura bitmapfileinfo");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 100,24,  255);
    LPBITMAPINFOHEADER v = s.getInfoHeader();
    CA_ASSERT(v != NULL);
    CA_ASSERT(v->biBitCount == 24);
    CA_ASSERT(v->biHeight == 100);
    CA_ASSERT(v->biWidth == 100);
    draw(&s);
}
Example #26
0
void test_bmpImage_class::test11(void)
{
    _START();
    _INFO("verifica interrna alla classe:metodo portrait");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    bmpImage s;
    s.create(100, 50,24,  255);
    CA_ASSERT((int)s.getWidth()==100);
    CA_ASSERT((int)s.getHeight()== 50);
    draw(&s);
    s.portrait(false);
    CA_ASSERT((int)s.getWidth()==50);
    CA_ASSERT((int)s.getHeight()==100);
    draw(&s);

}
Example #27
0
File: mn_scene.c Project: RedFT/ECS
void SceneManager_init(void *_self)
{
    if (!_self)
        return;
    SceneManager *self = _self;
    
    INIT(Manager, self->parent); // init superclass
    
    INIT_MAN("scenemanager", SceneManager, self); // assign function pointers
    self->registerApp = SceneManager_registerApp;
    
    INIT(EventSubsystem, self->event_ssys);
    INIT(MovementSubsystem, self->move_ssys);
    
    
    REGISTER(self->parent, Subsystem, self->event_ssys);
    REGISTER(self->parent, Subsystem, self->move_ssys);
    _INFO("Initialized %s", self->manager_type);
}
Example #28
0
void test_bmpImage_class::test5(void)
{
    _START();
    _INFO("verifica interrna alla classe : metodi copytofile and copyfromfile");
    _AUTHOR("Coppi Angelo bmpImage library ");
    _STOP();
    remove("./whiteImage.bmp");
    bmpImage s;
    s.create(100, 100,32,  255);
    s.frameRect(10,10,90,90,255,0,0,0xffffffff);
    draw(&s);
    bool res = s.copyToFile(X("./whiteImage.bmp"));
    CA_ASSERT(res==true);
    bmpImage t;
    t.copyFromFile(X("./whiteImage.bmp"));
    CA_ASSERT((LPBITMAPFILEHEADER)s!=NULL);
    CA_ASSERT((LPBITMAPFILEHEADER)t!=NULL);
    int res1 = memcmp((LPBITMAPFILEHEADER)s, (LPBITMAPFILEHEADER)t, ((LPBITMAPFILEHEADER)(s))->bfSize);
    CA_ASSERT(res1==0);
    draw(&t);
    //remove("./whiteImage.bmp");
}
Example #29
0
int main(int argc, char* argv[])
{
	mallopt(M_MMAP_THRESHOLD, 64*1024);
	const char *config_filename = argv[1];
	const char *config_keyname = DEFAULT_CONFIG_KEYNAME;
	if(argc>=3) config_keyname = argv[2];	

	close(STDIN_FILENO);
	signal(SIGPIPE, SIG_IGN);
	signal(SIGTERM, &sigterm_handler);
	signal(SIGINT, &sigint_handler);

	_INFO("[Server starting...] ");
	{
		int ret;
		Configuration config;
		if (config.open(config_filename, config_keyname))
		{
			_ERROR("open configure file and key name < %s : %s >error",config_filename,config_keyname);
			return -1;
		}

		Http_Server htp;

		Query_Processor processor;

		pthread_barrier_t processor_init;
		pthread_barrier_init(&processor_init, NULL, config.processor_num + 1);

		processor.register_httpserver(&htp);
		htp.register_processor(&processor);

		if((ret = processor.open(config.processor_num,config.thread_stack_size,&processor_init,config.data_path)) < 0)
		{
			_ERROR("open processor error! ret:%d,thread:%d",ret,config.processor_num);
			exit(-1);
		}
		if((ret = htp.open(config.receiver_num,config.thread_stack_size,config.listen_port)) <0 )
		{
			_ERROR("open http server error! ret:%d,thread:%d,listen port:%d",ret,config.receiver_num,config.listen_port);
			exit(-1);	
		}

		_INFO("Server initialized OK");
		processor.activate();
		pthread_barrier_wait(&processor_init);	// wait for all processors fully initialized
		//WEBSEARCH_DEBUG((LM_DEBUG,"processor activate\n"));
		sleep(1);
		htp.activate();
		//WEBSEARCH_DEBUG((LM_DEBUG,"http activate\n"));
		_INFO("[Server started]");

		pause();
		htp.stop();
		processor.stop();
		pthread_barrier_destroy(&processor_init);
	}
	_INFO("[Server stop]");

#ifdef WRITE_CERR_LOG_INTO_FILE
	file.close();
#endif
	return 0;
}
Example #30
0
static void do_handle_error(liGnuTLSFilter *f, const char *gnutlsfunc, int r, gboolean writing) {
	switch (r) {
	case GNUTLS_E_AGAIN:
		if (writing) f->write_wants_read = TRUE;
		return;
	case GNUTLS_E_REHANDSHAKE:
#ifdef HAVE_SAVE_RENEGOTIATION
		if (f->initial_handshaked_finished && !gnutls_safe_renegotiation_status(f->session)) {
			_ERROR(f->srv, f->wrk, f->log_context, "%s: client initiated unsafe renegotitation, closing connection", gnutlsfunc);
			f_close_with_alert(f, r);
		} else {
			_DEBUG(f->srv, f->wrk, f->log_context, "%s: client initiated renegotitation", gnutlsfunc);
		}
#else
		if (f->initial_handshaked_finished) {
			_ERROR(f->srv, f->wrk, f->log_context, "%s: client initiated renegotitation, closing connection", gnutlsfunc);
			f_close_with_alert(f, r);
		}
#endif
		return;
	case GNUTLS_E_UNEXPECTED_PACKET_LENGTH:
		f_close_with_alert(f, r);
		return;
	case GNUTLS_E_UNKNOWN_CIPHER_SUITE:
	case GNUTLS_E_UNSUPPORTED_VERSION_PACKET:
		_DEBUG(f->srv, f->wrk, f->log_context, "%s (%s): %s", gnutlsfunc,
			gnutls_strerror_name(r), gnutls_strerror(r));
		f_close_with_alert(f, r);
		return;
	case GNUTLS_E_FATAL_ALERT_RECEIVED:
	case GNUTLS_E_WARNING_ALERT_RECEIVED:
		{
			gnutls_alert_description_t alert_desc = gnutls_alert_get(f->session);
			const char* alert_desc_name = gnutls_alert_get_name(alert_desc);
			_INFO(f->srv, f->wrk, f->log_context, "%s (%s): %s %s (%u)", gnutlsfunc,
				gnutls_strerror_name(r), gnutls_strerror(r),
				(NULL != alert_desc_name) ? alert_desc_name : "unknown alert",
				(unsigned int) alert_desc);
		}
		/* error not handled yet: break instead of return */
		break;
	default:
		if (gnutls_error_is_fatal(r)) {
			_ERROR(f->srv, f->wrk, f->log_context, "%s (%s): %s", gnutlsfunc,
				gnutls_strerror_name(r), gnutls_strerror(r));
		} else {
			_WARNING(f->srv, f->wrk, f->log_context, "%s non fatal (%s): %s", gnutlsfunc,
				gnutls_strerror_name(r), gnutls_strerror(r));
		}
		/* error not handled yet: break instead of return */
		break;
	}

	/* generic error handling */
	if (gnutls_error_is_fatal(r)) {
		if (f->initial_handshaked_finished) {
			f_close_with_alert(f, r);
		} else {
			f_abort_gnutls(f);
		}
	}
}