mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-07-13 02:03:44 +00:00
Information packet (#382)
This PR adds an "I" packet which returns the server information. This can be used by external programs and the launcher to get information about a server without having to connect it to. It can be toggled in the config and in lua.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "Client.h"
|
||||
#include "Common.h"
|
||||
#include "LuaAPI.h"
|
||||
#include "THeartbeatThread.h"
|
||||
#include "TLuaEngine.h"
|
||||
#include "TScopedTimer.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
@@ -256,6 +257,9 @@ void TNetwork::Identify(TConnection&& RawConnection) {
|
||||
boost::system::error_code ec;
|
||||
write(RawConnection.Socket, buffer("P"), ec);
|
||||
return;
|
||||
} else if (Code == 'I') {
|
||||
boost::system::error_code ec;
|
||||
write(RawConnection.Socket, buffer(Application::Settings.getAsBool(Settings::Key::General_InformationPacket) ? THeartbeatThread::lastCall : ""), ec);
|
||||
} else {
|
||||
beammp_errorf("Invalid code got in Identify: '{}'", Code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user