mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-25 22:40:16 +00:00
Disable monitor by default in config file
This commit is contained in:
parent
26024de866
commit
46552307cd
@ -68,6 +68,7 @@ spawnz=-5500
|
|||||||
|
|
||||||
# Player location monitor interface configuration
|
# Player location monitor interface configuration
|
||||||
[monitor]
|
[monitor]
|
||||||
|
enabled=false
|
||||||
# the port to listen for connections on
|
# the port to listen for connections on
|
||||||
port=8003
|
port=8003
|
||||||
# how often the listeners should be updated (in milliseconds)
|
# how often the listeners should be updated (in milliseconds)
|
||||||
|
@ -13,6 +13,9 @@ static sockaddr_in address;
|
|||||||
|
|
||||||
// runs during init
|
// runs during init
|
||||||
void Monitor::init() {
|
void Monitor::init() {
|
||||||
|
if (!settings::MONITORENABLED)
|
||||||
|
return;
|
||||||
|
|
||||||
listener = socket(AF_INET, SOCK_STREAM, 0);
|
listener = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (SOCKETERROR(listener)) {
|
if (SOCKETERROR(listener)) {
|
||||||
std::cout << "Failed to create monitor socket" << std::endl;
|
std::cout << "Failed to create monitor socket" << std::endl;
|
||||||
@ -106,6 +109,9 @@ void Monitor::tick(CNServer *serv, time_t delta) {
|
|||||||
void Monitor::start(void *unused) {
|
void Monitor::start(void *unused) {
|
||||||
socklen_t len = sizeof(address);
|
socklen_t len = sizeof(address);
|
||||||
|
|
||||||
|
if (!settings::MONITORENABLED)
|
||||||
|
return;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int sock = accept(listener, (struct sockaddr*)&address, &len);
|
int sock = accept(listener, (struct sockaddr*)&address, &len);
|
||||||
if (SOCKETERROR(sock))
|
if (SOCKETERROR(sock))
|
||||||
|
@ -31,6 +31,7 @@ std::string settings::MOTDSTRING = "Welcome to OpenFusion!";
|
|||||||
int settings::ACCLEVEL = 1;
|
int settings::ACCLEVEL = 1;
|
||||||
|
|
||||||
// monitor settings
|
// monitor settings
|
||||||
|
bool settings::MONITORENABLED = false;
|
||||||
int settings::MONITORPORT = 8003;
|
int settings::MONITORPORT = 8003;
|
||||||
int settings::MONITORINTERVAL = 5000;
|
int settings::MONITORINTERVAL = 5000;
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ void settings::init() {
|
|||||||
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
ACCLEVEL = reader.GetInteger("shard", "accountlevel", ACCLEVEL);
|
||||||
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
EVENTMODE = reader.GetInteger("shard", "eventmode", EVENTMODE);
|
||||||
EVENTCRATECHANCE = reader.GetInteger("shard", "eventcratechance", EVENTCRATECHANCE);
|
EVENTCRATECHANCE = reader.GetInteger("shard", "eventcratechance", EVENTCRATECHANCE);
|
||||||
|
MONITORENABLED = reader.GetBoolean("monitor", "enabled", MONITORENABLED);
|
||||||
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
MONITORPORT = reader.GetInteger("monitor", "port", MONITORPORT);
|
||||||
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
MONITORINTERVAL = reader.GetInteger("monitor", "interval", MONITORINTERVAL);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ namespace settings {
|
|||||||
extern std::string GRUNTWORKJSON;
|
extern std::string GRUNTWORKJSON;
|
||||||
extern int EVENTMODE;
|
extern int EVENTMODE;
|
||||||
extern int EVENTCRATECHANCE;
|
extern int EVENTCRATECHANCE;
|
||||||
|
extern bool MONITORENABLED;
|
||||||
extern int MONITORPORT;
|
extern int MONITORPORT;
|
||||||
extern int MONITORINTERVAL;
|
extern int MONITORINTERVAL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user