本文整理汇总了C++中WorldServer::Disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ WorldServer::Disconnect方法的具体用法?C++ WorldServer::Disconnect怎么用?C++ WorldServer::Disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer
的用法示例。
在下文中一共展示了WorldServer::Disconnect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
worldserver.Disconnect();
// safe_delete(worldserver);
_log(ZONE__INIT, "Shutting down...");
}
示例2: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
RunLoops = false;
worldserver.Disconnect();
// safe_delete(worldserver);
LogFile->write(EQEMuLog::Status, "Shutting down...");
}
示例3: Shutdown
void Shutdown()
{
Zone::Shutdown(true);
MNetLoop.lock();
RunLoops = false;
worldserver.Disconnect();
MNetLoop.unlock();
// safe_delete(worldserver);
EQC::Common::PrintF(CP_ZONESERVER, "Shutting down...\n");
}
示例4: WorldServerLoop
// this should always be called in a new thread
void WorldServerLoop(void *tmp)
{
WorldLoopRunning = true;
while(RunLoops)
{
if (worldserver.Connected())
{
if (!(worldserver.ReceiveData() && worldserver.SendPacketQueue()))
{
worldserver.Disconnect();
}
}
else if (worldserver.GetState() == WSCS_Ready)
{
if (worldserver.ReconnectTimer->Check())
{
worldserver.Connect();
}
}
Sleep(1);
}
WorldLoopRunning = false;
}
示例5: main
//.........这里部分代码省略.........
zone = 0;
}
//register all the patches we have avaliable with the stream identifier.
EQStreamIdentifier stream_identifier;
RegisterAllPatches(stream_identifier);
#ifndef WIN32
_log(COMMON__THREADS, "Main thread running with thread id %d", pthread_self());
#endif
Timer quest_timers(100);
UpdateWindowTitle();
bool worldwasconnected = worldserver.Connected();
EQStream* eqss;
EQStreamInterface *eqsi;
Timer temp_timer(10);
temp_timer.Start();
while(RunLoops) {
{ //profiler block to omit the sleep from times
_ZP(net_main);
//Advance the timer to our current point in time
Timer::SetCurrentTime();
//process stuff from world
worldserver.Process();
if (!eqsf.IsOpen() && Config->ZonePort!=0) {
_log(ZONE__INIT, "Starting EQ Network server on port %d",Config->ZonePort);
if (!eqsf.Open(Config->ZonePort)) {
_log(ZONE__INIT_ERR, "Failed to open port %d",Config->ZonePort);
ZoneConfig::SetZonePort(0);
worldserver.Disconnect();
worldwasconnected = false;
}
}
//check the factory for any new incoming streams.
while ((eqss = eqsf.Pop())) {
//pull the stream out of the factory and give it to the stream identifier
//which will figure out what patch they are running, and set up the dynamic
//structures and opcodes for that patch.
struct in_addr in;
in.s_addr = eqss->GetRemoteIP();
_log(WORLD__CLIENT, "New connection from %s:%d", inet_ntoa(in),ntohs(eqss->GetRemotePort()));
stream_identifier.AddStream(eqss); //takes the stream
}
//give the stream identifier a chance to do its work....
stream_identifier.Process();
//check the stream identifier for any now-identified streams
while((eqsi = stream_identifier.PopIdentified())) {
//now that we know what patch they are running, start up their client object
struct in_addr in;
in.s_addr = eqsi->GetRemoteIP();
_log(WORLD__CLIENT, "New client from %s:%d", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
entity_list.AddClient(client);
}
//check for timeouts in other threads
timeout_manager.CheckTimeouts();
示例6: main
//.........这里部分代码省略.........
if (!worldserver.Connect()) {
LogFile->write(EQEMuLog::Error, "worldserver.Connect() FAILED!");
}
if (strcmp(zone_name, ".") == 0 || strcasecmp(zone_name, "sleep") == 0) {
LogFile->write(EQEMuLog::Status, "Entering sleep mode");
} else if (!Zone::Bootup(database.GetZoneID(zone_name), true)) {
LogFile->write(EQEMuLog::Error, "Zone bootup FAILED!");
zone = 0;
}
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
UpdateWindowTitle();
bool worldwasconnected = worldserver.Connected();
EQNetworkConnection* eqnc;
while(RunLoops) {
Timer::SetCurrentTime();
while ((eqnc = eqns.NewQueuePop())) {
struct in_addr in;
in.s_addr = eqnc->GetrIP();
LogFile->write(EQEMuLog::Status, "%i New client from ip:%s port:%i", Timer::GetCurrentTime(), inet_ntoa(in), ntohs(eqnc->GetrPort()));
Client* client = new Client(eqnc);
entity_list.AddClient(client);
}
#ifdef CATCH_CRASH
try{
#endif
worldserver.Process();
#ifdef CATCH_CRASH
}
catch(...){
error = 1;
adverrornum = worldserver.GetErrorNumber();
worldserver.Disconnect();
worldwasconnected = false;
}
#endif
if (worldserver.Connected()) {
worldwasconnected = true;
}
else {
if (worldwasconnected && ZoneLoaded)
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
worldwasconnected = false;
}
if (ZoneLoaded) {
{
#ifdef CATCH_CRASH
try{
#endif
entity_list.Process();
#ifdef CATCH_CRASH
}
catch(...){
error = 4;
}
try{
#endif
zoneprocess= zone->Process();
if (!zoneprocess) {
Zone::Shutdown();
}
#ifdef CATCH_CRASH
}
catch(...){
error = 2;