![]() |
Crossfire Server, Trunk
1.75.0
|
#include "global.h"#include <ctype.h>#include <mutex>#include <thread>#include <system_error>#include <time.h>#include <sys/stat.h>#include <sys/types.h>#include <netinet/in.h>#include <netdb.h>#include <arpa/inet.h>#include "metaserver2.h"#include "version.h"
Include dependency graph for metaserver.cpp:Go to the source code of this file.
Data Structures | |
| struct | LocalMeta2Info |
| LocalMeta2Info basically holds all the non server metaserver2 information that we read from the metaserver2 file. More... | |
Functions | |
| int | count_players () |
| bool | metaserver2_config_modified () |
| Return if the metaserver2 file has been modified since last load. More... | |
| void | metaserver2_exit () |
| Stop metaserver updates. More... | |
| int | metaserver2_init (void) |
| Initialize metaserver reporting. More... | |
| void | metaserver2_load_config () |
| void | metaserver_update (void) |
| Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for metaserver2, it just copies dynamic data into private data structure, doing locking in the process. More... | |
Variables | |
| static LocalMeta2Info | local_info |
| Non volatile information on the server. More... | |
| MetaServer2_UpdateInfo | metaserver2_updateinfo |
| Statistics on players and such sent to the metaserver2. More... | |
| static std::thread | metaserver_thread |
| Metaserver thread, if notifications are enabled. More... | |
| static std::vector< std::string > | metaservers |
| Metaservers to send information to, list of hostnames. More... | |
| static std::mutex | ms2_info_mutex |
| Mutex to protect access to metaserver2_updateinfo. More... | |
| static std::timed_mutex | ms2_signal |
| When this mutex becomes unlocked, make the metaserver thread exit. More... | |
| int count_players | ( | ) |
Definition at line 50 of file metaserver.cpp.
References first_player, FLAG_AFK, FLAG_WIZ, player::next, QUERY_FLAG, ST_GET_PARTY_PASSWORD, and ST_PLAYING.
Referenced by check_shutdown(), and metaserver_update().
Here is the caller graph for this function:| bool metaserver2_config_modified | ( | ) |
Return if the metaserver2 file has been modified since last load.
Definition at line 267 of file metaserver.cpp.
References buf, Settings::confdir, LocalMeta2Info::last_read, local_info, MAX_BUF, and settings.
| void metaserver2_exit | ( | ) |
Stop metaserver updates.
Definition at line 485 of file metaserver.cpp.
References metaserver_thread, and ms2_signal.
Referenced by cleanup().
Here is the caller graph for this function:| int metaserver2_init | ( | void | ) |
Initialize metaserver reporting.
Read the config file and launch the metaserver update thread, if enabled. Do not call this function more than once.
Definition at line 462 of file metaserver.cpp.
References llevError, local_info, LOG(), metaserver2_load_config(), metaserver_thread, ms2_signal, and LocalMeta2Info::notification.
Referenced by init().
Here is the call graph for this function:
Here is the caller graph for this function:| void metaserver2_load_config | ( | ) |
Definition at line 280 of file metaserver.cpp.
References LocalMeta2Info::archbase, buf, LocalMeta2Info::codebase, Settings::confdir, Settings::csport, FALSE, LocalMeta2Info::flags, LocalMeta2Info::hostname, LocalMeta2Info::html_comment, LocalMeta2Info::last_read, llevError, local_info, LOG(), LocalMeta2Info::mapbase, MAX_BUF, metaservers, LocalMeta2Info::notification, LocalMeta2Info::portnumber, settings, strcasecmp(), LocalMeta2Info::text_comment, time, and TRUE.
Referenced by metaserver2_init().
Here is the call graph for this function:
Here is the caller graph for this function:| void metaserver_update | ( | void | ) |
Updates our info in the metaserver Note that this is used for both metaserver1 and metaserver2 - for metaserver2, it just copies dynamic data into private data structure, doing locking in the process.
Definition at line 82 of file metaserver.cpp.
References count_players(), cst_tot, CS_Stats::ibytes, MetaServer2_UpdateInfo::in_bytes, metaserver2_updateinfo, ms2_info_mutex, MetaServer2_UpdateInfo::num_players, CS_Stats::obytes, MetaServer2_UpdateInfo::out_bytes, time, CS_Stats::time_start, and MetaServer2_UpdateInfo::uptime.
Referenced by do_specials().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Non volatile information on the server.
Definition at line 135 of file metaserver.cpp.
Referenced by metaserver2_config_modified(), metaserver2_init(), and metaserver2_load_config().
| MetaServer2_UpdateInfo metaserver2_updateinfo |
Statistics on players and such sent to the metaserver2.
Definition at line 141 of file metaserver.cpp.
Referenced by metaserver_update().
|
static |
Metaserver thread, if notifications are enabled.
Definition at line 138 of file metaserver.cpp.
Referenced by metaserver2_exit(), and metaserver2_init().
|
static |
Metaservers to send information to, list of hostnames.
Definition at line 111 of file metaserver.cpp.
Referenced by metaserver2_load_config().
|
static |
Mutex to protect access to metaserver2_updateinfo.
Definition at line 46 of file metaserver.cpp.
Referenced by metaserver_update().
|
static |
When this mutex becomes unlocked, make the metaserver thread exit.
Definition at line 48 of file metaserver.cpp.
Referenced by metaserver2_exit(), and metaserver2_init().