Crossfire Server, Trunk  R20513
Go to the documentation of this file.
9 #ifndef METASERVER2_H
10 #define METASERVER2_H
12 /*
13  * The current implementation of crossfire is not very thread
14  * friendly/safe - in fact, metaserver2 is the first part to
15  * use an extra thread.
16  * As such, it would be a lot of work to add the necessary
17  * locks in the rest of the code for the metaserver2 to be able
18  * to get the data it needs. So instead, we use this
19  * MS2UpdateInfo structure to get the data from the main thread
20  * to the metaserver thread - basically, the main thread
21  * gets a lock on the mutex, updates the fields in this structure
22  * and releases the lock. The metaserver2 thread will
23  * get a lock when it needs to get this information, copy
24  * it to the post form, then unlock the structure.
25  * In that way, neither side holds the lock very long, which is especially
26  * important because the metaserver2 thread could take quite a while
27  * to do its updates.
28  */
30 extern pthread_mutex_t ms2_info_mutex;
33 typedef struct _MetaServer2_UpdateInfo {
35  int in_bytes;
36  int out_bytes;
37  time_t uptime;
42 #endif /* METASERVER2_H */
struct _MetaServer2_UpdateInfo MetaServer2_UpdateInfo
Structure containing information sent to the metaserver2.
int out_bytes
Number of bytes sent.
Definition: metaserver2.h:36
int num_players
Number of players.
Definition: metaserver2.h:34
time_t uptime
How long server has been up.
Definition: metaserver2.h:37
MetaServer2_UpdateInfo metaserver2_updateinfo
Statistics on players and such sent to the metaserver2.
Definition: metaserver.c:135
int in_bytes
Number of bytes received.
Definition: metaserver2.h:35
Structure containing information sent to the metaserver2.
Definition: metaserver2.h:33
pthread_mutex_t ms2_info_mutex
Mutex to protect access to metaserver2_updateinfo.
Definition: metaserver.c:132