mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00
make beef dumps opt-in via config
This commit is contained in:
@@ -89,6 +89,10 @@
|
|||||||
#define DEV_LOG_LENGTH_DISCREPANCY
|
#define DEV_LOG_LENGTH_DISCREPANCY
|
||||||
// If defined, log chunk generation events
|
// If defined, log chunk generation events
|
||||||
#define DEV_LOG_CHUNK_GENERATION
|
#define DEV_LOG_CHUNK_GENERATION
|
||||||
|
// If defined, allows dumping world data by sending 0xBEEF (big-endian),
|
||||||
|
// and uploading world data by sending 0xFEED, followed by the data buffer.
|
||||||
|
// Doesn't implement authentication, hence disabled by default.
|
||||||
|
// #define DEV_ENABLE_BEEF_DUMPS
|
||||||
|
|
||||||
#define STATE_NONE 0
|
#define STATE_NONE 0
|
||||||
#define STATE_STATUS 1
|
#define STATE_STATUS 1
|
||||||
|
@@ -558,6 +558,8 @@ int main () {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle 0xBEEF and 0xFEED packets for dumping/uploading world data
|
||||||
|
#ifdef DEV_ENABLE_BEEF_DUMPS
|
||||||
// Received BEEF packet, dump world data and disconnect
|
// Received BEEF packet, dump world data and disconnect
|
||||||
if (recv_buffer[0] == 0xBE && recv_buffer[1] == 0xEF && getClientState(client_fd) == STATE_NONE) {
|
if (recv_buffer[0] == 0xBE && recv_buffer[1] == 0xEF && getClientState(client_fd) == STATE_NONE) {
|
||||||
// Send block changes and player data back to back
|
// Send block changes and player data back to back
|
||||||
@@ -571,7 +573,6 @@ int main () {
|
|||||||
disconnectClient(&clients[client_index], 6);
|
disconnectClient(&clients[client_index], 6);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Received FEED packet, load world data from socket and disconnect
|
// Received FEED packet, load world data from socket and disconnect
|
||||||
if (recv_buffer[0] == 0xFE && recv_buffer[1] == 0xED && getClientState(client_fd) == STATE_NONE) {
|
if (recv_buffer[0] == 0xFE && recv_buffer[1] == 0xED && getClientState(client_fd) == STATE_NONE) {
|
||||||
// Consume 0xFEED bytes (previous read was just a peek)
|
// Consume 0xFEED bytes (previous read was just a peek)
|
||||||
@@ -592,6 +593,7 @@ int main () {
|
|||||||
disconnectClient(&clients[client_index], 7);
|
disconnectClient(&clients[client_index], 7);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Read packet length
|
// Read packet length
|
||||||
int length = readVarInt(client_fd);
|
int length = readVarInt(client_fd);
|
||||||
|
Reference in New Issue
Block a user