Ejemplo n.º 1
0
void theLoop::Looper() {
#ifdef _WIN32
	KillTimer(NULL, srvLoopTimer);
#endif

	// PPK ... two loop stategy for saving badwith
	if(bRecv == true) {
		ReceiveLoop();
	} else {
		SendLoop();
		eventqueue->ProcessEvents();
	}

	if(bServerTerminated == false) {
		bRecv = !bRecv;

#ifdef _WIN32
        srvLoopTimer = SetTimer(NULL, 0, 100, NULL);

	    if(srvLoopTimer == 0) {
	        AppendDebugLog("%s - [ERR] Cannot start Looper in theLoop::Looper\n", 0);
	        exit(EXIT_FAILURE);
	    }
#endif
	} else {
	    // tell the scripts about the end
	    ScriptManager->OnExit();
	    
	    // send last possible global data
	    g_GlobalDataQueue->SendFinalQueue();
	    
	    ServerFinalStop(true);
	}
}
Ejemplo n.º 2
0
void AsiPort::Run()
{
    if( _direction.compare("send") == 0 ){
        SendLoop();
    }
    else{
        RevLoop();
    }

}