本文整理汇总了C++中ZSList::KillAll方法的典型用法代码示例。如果您正苦于以下问题:C++ ZSList::KillAll方法的具体用法?C++ ZSList::KillAll怎么用?C++ ZSList::KillAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZSList
的用法示例。
在下文中一共展示了ZSList::KillAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
_log(WORLD__ZONE, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
console_list.Add(new Console(tcpc));
}
if(PurgeInstanceTimer.Check())
{
database.PurgeExpiredInstances();
}
//check for timeouts in other threads
timeout_manager.CheckTimeouts();
loginserver.Process();
console_list.Process();
zoneserver_list.Process();
launcher_list.Process();
LFPGroupList.Process();
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
AsyncLoadVariables(dbasync, &database);
if (Config->LoginHost.length() && loginserver.Connected() == false) {
#ifdef WIN32
_beginthread(AutoInitLoginServer, 0, NULL);
#else
pthread_t thread;
pthread_create(&thread, NULL, &AutoInitLoginServer, NULL);
#endif
}
}
if (numclients == 0) {
Sleep(50);
continue;
}
Sleep(20);
}
_log(WORLD__SHUTDOWN,"World main loop completed.");
_log(WORLD__SHUTDOWN,"Shutting down console connections (if any).");
console_list.KillAll();
_log(WORLD__SHUTDOWN,"Shutting down zone connections (if any).");
zoneserver_list.KillAll();
_log(WORLD__SHUTDOWN,"Zone (TCP) listener stopped.");
tcps.Close();
_log(WORLD__SHUTDOWN,"Client (UDP) listener stopped.");
eqsf.Close();
_log(WORLD__SHUTDOWN,"Signaling HTTP service to stop...");
http_server.Stop();
#if 0
#if defined(SHAREMEM) && !defined(WIN32)
for (int ipc_files = 0; ipc_files <= 4; ipc_files++) {
key_t share_key;
switch (ipc_files) {
// Item
case 0: share_key = ftok(".", 'I'); break;
// Npctype
case 1: share_key = ftok(".", 'N'); break;
// Door
case 2: share_key = ftok(".", 'D'); break;
// Spell
case 3: share_key = ftok(".", 'S'); break;
// Faction
case 4: share_key = ftok(".", 'F'); break;
// ERROR Fatal
default: cerr<<"Opps!"<<endl; share_key = 0xFF; break;
}
int share_id = shmget(share_key, 0, IPC_NOWAIT|0400);
if (share_id <= 0) {
cerr<<"exiting could not check user count on shared memory ipcs mem leak!!!!!!!! id="<<share_id<<" key:"<<share_key<<endl;
exit(1);
}
struct shmid_ds mem_users;
if ((shmctl(share_id, IPC_STAT, &mem_users)) != 0) {
cerr<<"exiting error checking user count on shared memory, marking for deletion!!!!!id="<<share_id<<" key:"<<share_key<<endl;
shmctl(share_id, IPC_RMID, 0);
exit(1);
}
if (mem_users.shm_nattch == 0) {
//cerr<<"exiting stale share marked for deletion!id="<<share_id<<" key:"<<share_key<<endl;
shmctl(share_id, IPC_RMID, 0);
}
else if (mem_users.shm_nattch == 1) {
//cerr<<"mem_users = 1"<<endl;
// Detatch and delete shared mem here
EMuShareMemDLL.Unload();
shmctl(share_id, IPC_RMID, 0);
}
}
#endif
#endif
CheckEQEMuErrorAndPause();
return 0;
}
示例2: main
//.........这里部分代码省略.........
//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();
if (RuleB(World, UseBannedIPsTable)){ //Lieka: Check to see if we have the responsibility for blocking IPs.
_log(WORLD__CLIENT, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))){ //Lieka: Check inbound IP against banned IP table.
_log(WORLD__CLIENT, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
} else {
_log(WORLD__CLIENT, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)){
_log(WORLD__CLIENT, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
Client* client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
}
client_list.Process();
while ((tcpc = tcps.NewQueuePop())) {
struct in_addr in;
in.s_addr = tcpc->GetrIP();
_log(WORLD__ZONE, "New TCP connection from %s:%d", inet_ntoa(in),tcpc->GetrPort());
console_list.Add(new Console(tcpc));
}
if(PurgeInstanceTimer.Check())
{
database.PurgeExpiredInstances();
}
//check for timeouts in other threads
timeout_manager.CheckTimeouts();
loginserverlist.Process();
console_list.Process();
zoneserver_list.Process();
launcher_list.Process();
UCSLink.Process();
QSLink.Process();
LFPGroupList.Process();
adventure_manager.Process();
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
AsyncLoadVariables(dbasync, &database);
ReconnectCounter++;
if (ReconnectCounter >= 12) { // only create thread to reconnect every 10 minutes. previously we were creating a new thread every 10 seconds
ReconnectCounter = 0;
if (loginserverlist.AllConnected() == false) {
#ifdef _WINDOWS
_beginthread(AutoInitLoginServer, 0, nullptr);
#else
pthread_t thread;
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
#endif
}
}
}
if (numclients == 0) {
Sleep(50);
continue;
}
Sleep(20);
}
_log(WORLD__SHUTDOWN,"World main loop completed.");
_log(WORLD__SHUTDOWN,"Shutting down console connections (if any).");
console_list.KillAll();
_log(WORLD__SHUTDOWN,"Shutting down zone connections (if any).");
zoneserver_list.KillAll();
_log(WORLD__SHUTDOWN,"Zone (TCP) listener stopped.");
tcps.Close();
_log(WORLD__SHUTDOWN,"Client (UDP) listener stopped.");
eqsf.Close();
_log(WORLD__SHUTDOWN,"Signaling HTTP service to stop...");
http_server.Stop();
CheckEQEMuErrorAndPause();
return 0;
}
示例3: main
//.........这里部分代码省略.........
connection->GetUUID());
web_interface.RemoveConnection(connection);
});
EQ::Net::EQStreamManagerOptions opts(9000, false, false);
EQ::Net::EQStreamManager eqsm(opts);
//register all the patches we have avaliable with the stream identifier.
EQStreamIdentifier stream_identifier;
RegisterAllPatches(stream_identifier);
zoneserver_list.shutdowntimer = new Timer(60000);
zoneserver_list.shutdowntimer->Disable();
zoneserver_list.reminder = new Timer(20000);
zoneserver_list.reminder->Disable();
Timer InterserverTimer(INTERSERVER_TIMER); // does MySQL pings and auto-reconnect
InterserverTimer.Trigger();
uint8 ReconnectCounter = 100;
std::shared_ptr<EQStreamInterface> eqs;
EQStreamInterface *eqsi;
eqsm.OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
stream_identifier.AddStream(stream);
LogF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->RemoteEndpoint(), ntohs(stream->GetRemotePort()));
});
while (RunLoops) {
Timer::SetCurrentTime();
eqs = nullptr;
//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();
if (RuleB(World, UseBannedIPsTable)) { //Lieka: Check to see if we have the responsibility for blocking IPs.
Log(Logs::Detail, Logs::World_Server, "Checking inbound connection %s against BannedIPs table", inet_ntoa(in));
if (!database.CheckBannedIPs(inet_ntoa(in))) { //Lieka: Check inbound IP against banned IP table.
Log(Logs::Detail, Logs::World_Server, "Connection %s PASSED banned IPs check. Processing connection.", inet_ntoa(in));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
else {
Log(Logs::General, Logs::World_Server, "Connection from %s FAILED banned IPs check. Closing connection.", inet_ntoa(in));
eqsi->Close(); //Lieka: If the inbound IP is on the banned table, close the EQStream.
}
}
if (!RuleB(World, UseBannedIPsTable)) {
Log(Logs::Detail, Logs::World_Server, "New connection from %s:%d, processing connection", inet_ntoa(in), ntohs(eqsi->GetRemotePort()));
auto client = new Client(eqsi);
// @merth: client->zoneattempt=0;
client_list.Add(client);
}
}
client_list.Process();
if (PurgeInstanceTimer.Check())
{
database.PurgeExpiredInstances();
}
if (EQTimeTimer.Check()) {
TimeOfDay_Struct tod;
zoneserver_list.worldclock.GetCurrentEQTimeOfDay(time(0), &tod);
if (!database.SaveTime(tod.minute, tod.hour, tod.day, tod.month, tod.year))
Log(Logs::General, Logs::World_Server, "Failed to save eqtime.");
else
Log(Logs::Detail, Logs::World_Server, "EQTime successfully saved.");
}
zoneserver_list.Process();
launcher_list.Process();
LFPGroupList.Process();
adventure_manager.Process();
if (InterserverTimer.Check()) {
InterserverTimer.Start();
database.ping();
std::string window_title = StringFormat("World: %s Clients: %i", Config->LongName.c_str(), client_list.GetClientCount());
UpdateWindowTitle(window_title);
}
EQ::EventLoop::Get().Process();
Sleep(5);
}
Log(Logs::General, Logs::World_Server, "World main loop completed.");
Log(Logs::General, Logs::World_Server, "Shutting down zone connections (if any).");
zoneserver_list.KillAll();
Log(Logs::General, Logs::World_Server, "Zone (TCP) listener stopped.");
Log(Logs::General, Logs::World_Server, "Signaling HTTP service to stop...");
LogSys.CloseFileLogs();
return 0;
}