void ColladaViewerModule::Initialize() { // Getting needed pointers TundraLogic::TundraLogicModule* tundra_ = framework_->GetModule<TundraLogic::TundraLogicModule>(); assetAPI_ = framework_->Asset(); client_ = tundra_->GetClient().get(); server_ = tundra_->GetServer().get(); // Getting remote collada storage url if(framework_->HasCommandLineParameter("--remoteColladaStorage")) { QStringList params = framework_->CommandLineParameters("--remoteColladaStorage"); if(params.length() > 0) remoteStorageUrl = params.at(0).toStdString(); } /// Initializing signal listeners // Starts the server process if the module runs on tundra server bool check = connect(server_, SIGNAL(ServerStarted()), this, SLOT(serverProcess()), Qt::QueuedConnection); Q_ASSERT(check); // Starts the client process if the module runs on tundra client check = connect(client_, SIGNAL(Connected(UserConnectedResponseData *)), this, SLOT(clientProcess()), Qt::QueuedConnection); Q_ASSERT(check); }
void MyBaseServer::mainLoop() { while(!isFini()) { serverProcess(); usleep(3*1000); } }
void PacketManager::process(boost::shared_ptr<IPacket> iPack) { if (iPack->getServerRead()) { serverProcess(iPack); } else { boost::shared_ptr<OPacket> oPack = server->createOPacket(iPack, true); server->getClientManager()->send(oPack); } }
int main(void) { int ret=-1; int port =8006; printf("Server start up!\n"); /*server main process function.*/ ret = serverProcess(port); if (TRUE == ret) printf("Server shutdown normally.(CODE:%d).\n", ret); else printf("Server abort.(CODE:%d).\n ", ret); return ret; }
// Process a time event and update all sub-processes void processTimeEvent(S32 elapsedTime) { PROFILE_START(ProcessTimeEvent); // If recording a video and not playinb back a journal, override the elapsedTime if (VIDCAP->isRecording() && !Journal::IsPlaying()) elapsedTime = VIDCAP->getMsPerFrame(); // cap the elapsed time to one second // if it's more than that we're probably in a bad catch-up situation if(elapsedTime > 1024) elapsedTime = 1024; U32 timeDelta; if(ATTS(gTimeAdvance)) timeDelta = ATTS(gTimeAdvance); else timeDelta = (U32) (elapsedTime * ATTS(gTimeScale)); Platform::advanceTime(elapsedTime); // Don't build up more time than a single tick... this makes the sim // frame rate dependent but is a useful hack for singleplayer. if ( ATTS(gFrameSkip) ) if ( timeDelta > TickMs ) timeDelta = TickMs; bool tickPass; PROFILE_START(ServerProcess); tickPass = serverProcess(timeDelta); PROFILE_END(); PROFILE_START(ServerNetProcess); // only send packets if a tick happened if(tickPass) GNet->processServer(); // Used to indicate if server was just ticked. Con::setBoolVariable( "$pref::hasServerTicked", tickPass ); PROFILE_END(); PROFILE_START(SimAdvanceTime); Sim::advanceTime(timeDelta); PROFILE_END(); PROFILE_START(ClientProcess); tickPass = clientProcess(timeDelta); // Used to indicate if client was just ticked. Con::setBoolVariable( "$pref::hasClientTicked", tickPass ); PROFILE_END_NAMED(ClientProcess); PROFILE_START(ClientNetProcess); if(tickPass) GNet->processClient(); PROFILE_END(); GNet->checkTimeouts(); gFPS.update(); // Give the texture manager a chance to cleanup any // textures that haven't been referenced for a bit. if( GFX ) TEXMGR->cleanupCache( 5 ); PROFILE_END(); // Update the console time Con::setFloatVariable("Sim::Time",F32(Platform::getVirtualMilliseconds()) / 1000); }