mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
Remove DSTACK support (#6346)
Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
This commit is contained in:
parent
43f9e948a1
commit
bd6b90359c
@ -252,8 +252,6 @@ Client::~Client()
|
||||
|
||||
void Client::connect(Address address, bool is_local_server)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
initLocalMapSaving(address, m_address_name, is_local_server);
|
||||
|
||||
m_con->SetTimeoutMs(0);
|
||||
@ -262,8 +260,6 @@ void Client::connect(Address address, bool is_local_server)
|
||||
|
||||
void Client::step(float dtime)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
// Limit a bit
|
||||
if(dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
@ -773,7 +769,6 @@ void Client::initLocalMapSaving(const Address &address,
|
||||
|
||||
void Client::ReceiveAll()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
u64 start_ms = porting::getTimeMs();
|
||||
for(;;)
|
||||
{
|
||||
@ -799,7 +794,6 @@ void Client::ReceiveAll()
|
||||
|
||||
void Client::Receive()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
NetworkPacket pkt;
|
||||
m_con->Receive(&pkt);
|
||||
ProcessData(&pkt);
|
||||
@ -816,8 +810,6 @@ inline void Client::handleCommand(NetworkPacket* pkt)
|
||||
*/
|
||||
void Client::ProcessData(NetworkPacket *pkt)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
ToClientCommand command = (ToClientCommand) pkt->getCommand();
|
||||
u32 sender_peer_id = pkt->getPeerId();
|
||||
|
||||
@ -1235,8 +1227,6 @@ void Client::sendChangePassword(const std::string &oldpassword,
|
||||
|
||||
void Client::sendDamage(u8 damage)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
|
||||
pkt << damage;
|
||||
Send(&pkt);
|
||||
@ -1244,8 +1234,6 @@ void Client::sendDamage(u8 damage)
|
||||
|
||||
void Client::sendBreath(u16 breath)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
// Protocol v29 make this obsolete
|
||||
if (m_proto_ver >= 29)
|
||||
return;
|
||||
@ -1257,16 +1245,12 @@ void Client::sendBreath(u16 breath)
|
||||
|
||||
void Client::sendRespawn()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOSERVER_RESPAWN, 0);
|
||||
Send(&pkt);
|
||||
}
|
||||
|
||||
void Client::sendReady()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOSERVER_CLIENT_READY,
|
||||
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
|
||||
|
||||
|
@ -73,8 +73,6 @@ public:
|
||||
QUICKTUNE_INC,
|
||||
QUICKTUNE_DEC,
|
||||
|
||||
DEBUG_STACKS,
|
||||
|
||||
// hotbar
|
||||
SLOT_1,
|
||||
SLOT_2,
|
||||
|
@ -79,7 +79,6 @@ ClientMap & ClientEnvironment::getClientMap()
|
||||
|
||||
void ClientEnvironment::setLocalPlayer(LocalPlayer *player)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
/*
|
||||
It is a failure if already is a local player
|
||||
*/
|
||||
@ -91,8 +90,6 @@ void ClientEnvironment::setLocalPlayer(LocalPlayer *player)
|
||||
|
||||
void ClientEnvironment::step(float dtime)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
/* Step time of day */
|
||||
stepTimeOfDay(dtime);
|
||||
|
||||
|
@ -66,9 +66,6 @@ void RemoteClient::GetNextBlocks (
|
||||
float dtime,
|
||||
std::vector<PrioritySortedBlockTransfer> &dest)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
|
||||
// Increment timers
|
||||
m_nothing_to_send_pause_timer -= dtime;
|
||||
m_nearest_unsent_reset_timer += dtime;
|
||||
|
@ -62,7 +62,6 @@ ClientMap::ClientMap(
|
||||
|
||||
MapSector * ClientMap::emergeSector(v2s16 p2d)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
// Check that it doesn't exist already
|
||||
try {
|
||||
return getSectorNoGenerate(p2d);
|
||||
@ -303,8 +302,6 @@ struct MeshBufListList
|
||||
|
||||
void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
bool is_transparent_pass = pass == scene::ESNRP_TRANSPARENT;
|
||||
|
||||
std::string prefix;
|
||||
|
133
src/debug.cpp
133
src/debug.cpp
@ -56,8 +56,6 @@ void sanity_check_fn(const char *assertion, const char *file,
|
||||
errorstream << file << ":" << line << ": " << function
|
||||
<< ": An engine assumption '" << assertion << "' failed." << std::endl;
|
||||
|
||||
debug_stacks_print_to(errorstream);
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
@ -73,140 +71,9 @@ void fatal_error_fn(const char *msg, const char *file,
|
||||
errorstream << file << ":" << line << ": " << function
|
||||
<< ": A fatal error occured: " << msg << std::endl;
|
||||
|
||||
debug_stacks_print_to(errorstream);
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
/*
|
||||
DebugStack
|
||||
*/
|
||||
|
||||
struct DebugStack
|
||||
{
|
||||
DebugStack(std::thread::id id);
|
||||
void print(FILE *file, bool everything);
|
||||
void print(std::ostream &os, bool everything);
|
||||
|
||||
std::thread::id thread_id;
|
||||
char stack[DEBUG_STACK_SIZE][DEBUG_STACK_TEXT_SIZE];
|
||||
int stack_i; // Points to the lowest empty position
|
||||
int stack_max_i; // Highest i that was seen
|
||||
};
|
||||
|
||||
DebugStack::DebugStack(std::thread::id id)
|
||||
{
|
||||
thread_id = id;
|
||||
stack_i = 0;
|
||||
stack_max_i = 0;
|
||||
memset(stack, 0, DEBUG_STACK_SIZE*DEBUG_STACK_TEXT_SIZE);
|
||||
}
|
||||
|
||||
void DebugStack::print(FILE *file, bool everything)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << thread_id;
|
||||
fprintf(file, "DEBUG STACK FOR THREAD %s:\n",
|
||||
os.str().c_str());
|
||||
|
||||
for (int i = 0; i < stack_max_i; i++) {
|
||||
if (i == stack_i && !everything)
|
||||
break;
|
||||
|
||||
if (i < stack_i)
|
||||
fprintf(file, "#%d %s\n", i, stack[i]);
|
||||
else
|
||||
fprintf(file, "(Leftover data: #%d %s)\n", i, stack[i]);
|
||||
}
|
||||
|
||||
if (stack_i == DEBUG_STACK_SIZE)
|
||||
fprintf(file, "Probably overflown.\n");
|
||||
}
|
||||
|
||||
void DebugStack::print(std::ostream &os, bool everything)
|
||||
{
|
||||
os<<"DEBUG STACK FOR THREAD "<<thread_id<<": "<<std::endl;
|
||||
|
||||
for(int i = 0; i < stack_max_i; i++) {
|
||||
if(i == stack_i && !everything)
|
||||
break;
|
||||
|
||||
if (i < stack_i)
|
||||
os<<"#"<<i<<" "<<stack[i]<<std::endl;
|
||||
else
|
||||
os<<"(Leftover data: #"<<i<<" "<<stack[i]<<")"<<std::endl;
|
||||
}
|
||||
|
||||
if (stack_i == DEBUG_STACK_SIZE)
|
||||
os<<"Probably overflown."<<std::endl;
|
||||
}
|
||||
|
||||
std::map<std::thread::id, DebugStack*> g_debug_stacks;
|
||||
std::mutex g_debug_stacks_mutex;
|
||||
|
||||
void debug_stacks_print_to(std::ostream &os)
|
||||
{
|
||||
MutexAutoLock lock(g_debug_stacks_mutex);
|
||||
|
||||
os<<"Debug stacks:"<<std::endl;
|
||||
|
||||
for (auto it : g_debug_stacks) {
|
||||
it.second->print(os, false);
|
||||
}
|
||||
}
|
||||
|
||||
void debug_stacks_print()
|
||||
{
|
||||
debug_stacks_print_to(errorstream);
|
||||
}
|
||||
|
||||
DebugStacker::DebugStacker(const char *text)
|
||||
{
|
||||
std::thread::id thread_id = std::this_thread::get_id();
|
||||
|
||||
MutexAutoLock lock(g_debug_stacks_mutex);
|
||||
|
||||
auto n = g_debug_stacks.find(thread_id);
|
||||
if (n != g_debug_stacks.end()) {
|
||||
m_stack = n->second;
|
||||
} else {
|
||||
/*DEBUGPRINT("Creating new debug stack for thread %x\n",
|
||||
(unsigned int)thread_id);*/
|
||||
m_stack = new DebugStack(thread_id);
|
||||
g_debug_stacks[thread_id] = m_stack;
|
||||
}
|
||||
|
||||
if (m_stack->stack_i >= DEBUG_STACK_SIZE) {
|
||||
m_overflowed = true;
|
||||
} else {
|
||||
m_overflowed = false;
|
||||
|
||||
snprintf(m_stack->stack[m_stack->stack_i],
|
||||
DEBUG_STACK_TEXT_SIZE, "%s", text);
|
||||
m_stack->stack_i++;
|
||||
if (m_stack->stack_i > m_stack->stack_max_i)
|
||||
m_stack->stack_max_i = m_stack->stack_i;
|
||||
}
|
||||
}
|
||||
|
||||
DebugStacker::~DebugStacker()
|
||||
{
|
||||
MutexAutoLock lock(g_debug_stacks_mutex);
|
||||
|
||||
if (m_overflowed)
|
||||
return;
|
||||
|
||||
m_stack->stack_i--;
|
||||
|
||||
if (m_stack->stack_i == 0) {
|
||||
std::thread::id thread_id = m_stack->thread_id;
|
||||
/*DEBUGPRINT("Deleting debug stack for thread %x\n",
|
||||
(unsigned int)thread_id);*/
|
||||
delete m_stack;
|
||||
g_debug_stacks.erase(thread_id);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
const char *Win32ExceptionCodeToString(DWORD exception_code)
|
||||
|
30
src/debug.h
30
src/debug.h
@ -83,36 +83,6 @@ NORETURN extern void sanity_check_fn(
|
||||
|
||||
void debug_set_exception_handler();
|
||||
|
||||
/*
|
||||
DebugStack
|
||||
*/
|
||||
|
||||
#define DEBUG_STACK_SIZE 50
|
||||
#define DEBUG_STACK_TEXT_SIZE 300
|
||||
|
||||
extern void debug_stacks_print_to(std::ostream &os);
|
||||
extern void debug_stacks_print();
|
||||
|
||||
struct DebugStack;
|
||||
class DebugStacker
|
||||
{
|
||||
public:
|
||||
DebugStacker(const char *text);
|
||||
~DebugStacker();
|
||||
|
||||
private:
|
||||
DebugStack *m_stack;
|
||||
bool m_overflowed;
|
||||
};
|
||||
|
||||
#define DSTACK(msg) \
|
||||
DebugStacker __debug_stacker(msg);
|
||||
|
||||
#define DSTACKF(...) \
|
||||
char __buf[DEBUG_STACK_TEXT_SIZE]; \
|
||||
snprintf(__buf, DEBUG_STACK_TEXT_SIZE, __VA_ARGS__); \
|
||||
DebugStacker __debug_stacker(__buf);
|
||||
|
||||
/*
|
||||
These should be put into every thread
|
||||
*/
|
||||
|
@ -598,7 +598,6 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata,
|
||||
|
||||
void *EmergeThread::run()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
v3s16 pos;
|
||||
|
10
src/game.cpp
10
src/game.cpp
@ -1099,8 +1099,6 @@ void KeyCache::populate()
|
||||
key[KeyType::QUICKTUNE_INC] = getKeySetting("keymap_quicktune_inc");
|
||||
key[KeyType::QUICKTUNE_DEC] = getKeySetting("keymap_quicktune_dec");
|
||||
|
||||
key[KeyType::DEBUG_STACKS] = getKeySetting("keymap_print_debug_stacks");
|
||||
|
||||
for (int i = 0; i < 23; i++) {
|
||||
std::string slot_key_name = "keymap_slot" + std::to_string(i + 1);
|
||||
key[KeyType::SLOT_1 + i] = getKeySetting(slot_key_name.c_str());
|
||||
@ -2609,14 +2607,6 @@ void Game::processKeyInput()
|
||||
quicktune->inc();
|
||||
} else if (wasKeyDown(KeyType::QUICKTUNE_DEC)) {
|
||||
quicktune->dec();
|
||||
} else if (wasKeyDown(KeyType::DEBUG_STACKS)) {
|
||||
// Print debug stacks
|
||||
dstream << "-----------------------------------------"
|
||||
<< std::endl;
|
||||
dstream << "Printing debug stacks:" << std::endl;
|
||||
dstream << "-----------------------------------------"
|
||||
<< std::endl;
|
||||
debug_stacks_print();
|
||||
}
|
||||
|
||||
if (!isKeyDown(KeyType::JUMP) && runData.reset_jump_timer) {
|
||||
|
@ -63,7 +63,6 @@ enum
|
||||
GUI_ID_KEY_MUTE_BUTTON,
|
||||
GUI_ID_KEY_DEC_VOLUME_BUTTON,
|
||||
GUI_ID_KEY_INC_VOLUME_BUTTON,
|
||||
GUI_ID_KEY_DUMP_BUTTON,
|
||||
GUI_ID_KEY_RANGE_BUTTON,
|
||||
GUI_ID_KEY_ZOOM_BUTTON,
|
||||
GUI_ID_KEY_CAMERA_BUTTON,
|
||||
@ -433,6 +432,5 @@ void GUIKeyChangeMenu::init_keys()
|
||||
this->add_key(GUI_ID_KEY_HUD_BUTTON, wgettext("Toggle HUD"), "keymap_toggle_hud");
|
||||
this->add_key(GUI_ID_KEY_CHATLOG_BUTTON, wgettext("Toggle chat log"), "keymap_toggle_chat");
|
||||
this->add_key(GUI_ID_KEY_FOG_BUTTON, wgettext("Toggle fog"), "keymap_toggle_force_fog_off");
|
||||
this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks");
|
||||
}
|
||||
|
||||
|
@ -642,8 +642,6 @@ protected:
|
||||
|
||||
void *run()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
CurlHandlePool pool;
|
||||
|
||||
m_multi = curl_multi_init();
|
||||
|
@ -57,9 +57,7 @@ ItemStack::ItemStack(const std::string &name_, u16 count_,
|
||||
|
||||
void ItemStack::serialize(std::ostream &os) const
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
if(empty())
|
||||
if (empty())
|
||||
return;
|
||||
|
||||
// Check how many parts of the itemstring are needed
|
||||
@ -84,8 +82,6 @@ void ItemStack::serialize(std::ostream &os) const
|
||||
|
||||
void ItemStack::deSerialize(std::istream &is, IItemDefManager *itemdef)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
clear();
|
||||
|
||||
// Read name
|
||||
|
@ -842,8 +842,6 @@ bool getCraftingResult(Inventory *inv, ItemStack &result,
|
||||
std::vector<ItemStack> &output_replacements,
|
||||
bool decrementInput, IGameDef *gamedef)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
result.clear();
|
||||
|
||||
// Get the InventoryList in which we will operate
|
||||
|
@ -151,9 +151,6 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Initialize debug stacks
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
// Debug handler
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
@ -779,8 +776,6 @@ static bool determine_subgame(GameParams *game_params)
|
||||
*****************************************************************************/
|
||||
static bool run_dedicated_server(const GameParams &game_params, const Settings &cmd_args)
|
||||
{
|
||||
DSTACK("Dedicated server branch");
|
||||
|
||||
verbosestream << _("Using world path") << " ["
|
||||
<< game_params.world_path << "]" << std::endl;
|
||||
verbosestream << _("Using gameid") << " ["
|
||||
|
28
src/map.cpp
28
src/map.cpp
@ -220,7 +220,6 @@ void Map::setNode(v3s16 p, MapNode & n)
|
||||
<<" while trying to replace \""
|
||||
<<m_nodedef->get(block->getNodeNoCheck(relpos, &temp_bool)).name
|
||||
<<"\" at "<<PP(p)<<" (block "<<PP(blockpos)<<")"<<std::endl;
|
||||
debug_stacks_print_to(infostream);
|
||||
return;
|
||||
}
|
||||
block->setNodeNoCheck(relpos, n);
|
||||
@ -546,9 +545,6 @@ s32 Map::transforming_liquid_size() {
|
||||
void Map::transformLiquids(std::map<v3s16, MapBlock*> &modified_blocks,
|
||||
ServerEnvironment *env)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
//TimeTaker timer("transformLiquids()");
|
||||
|
||||
u32 loopcount = 0;
|
||||
u32 initial_size = m_transforming_liquid.size();
|
||||
|
||||
@ -1432,10 +1428,6 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
|
||||
|
||||
MapSector *ServerMap::createSector(v2s16 p2d)
|
||||
{
|
||||
DSTACKF("%s: p2d=(%d,%d)",
|
||||
FUNCTION_NAME,
|
||||
p2d.X, p2d.Y);
|
||||
|
||||
/*
|
||||
Check if it exists already in memory
|
||||
*/
|
||||
@ -1479,12 +1471,6 @@ MapBlock * ServerMap::generateBlock(
|
||||
std::map<v3s16, MapBlock*> &modified_blocks
|
||||
)
|
||||
{
|
||||
DSTACKF("%s: p=(%d,%d,%d)", FUNCTION_NAME, p.X, p.Y, p.Z);
|
||||
|
||||
/*infostream<<"generateBlock(): "
|
||||
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
|
||||
<<std::endl;*/
|
||||
|
||||
bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
||||
|
||||
TimeTaker timer("generateBlock");
|
||||
@ -1588,9 +1574,6 @@ MapBlock * ServerMap::generateBlock(
|
||||
|
||||
MapBlock * ServerMap::createBlock(v3s16 p)
|
||||
{
|
||||
DSTACKF("%s: p=(%d,%d,%d)",
|
||||
FUNCTION_NAME, p.X, p.Y, p.Z);
|
||||
|
||||
/*
|
||||
Do not create over max mapgen limit
|
||||
*/
|
||||
@ -1632,10 +1615,6 @@ MapBlock * ServerMap::createBlock(v3s16 p)
|
||||
|
||||
MapBlock * ServerMap::emergeBlock(v3s16 p, bool create_blank)
|
||||
{
|
||||
DSTACKF("%s: p=(%d,%d,%d), create_blank=%d",
|
||||
FUNCTION_NAME,
|
||||
p.X, p.Y, p.Z, create_blank);
|
||||
|
||||
{
|
||||
MapBlock *block = getBlockNoCreateNoEx(p);
|
||||
if (block && !block->isDummy())
|
||||
@ -1825,7 +1804,6 @@ std::string ServerMap::getBlockFilename(v3s16 p)
|
||||
|
||||
void ServerMap::save(ModifiedState save_level)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
if (!m_map_saving_enabled) {
|
||||
warningstream<<"Not saving map, saving disabled."<<std::endl;
|
||||
return;
|
||||
@ -1991,8 +1969,6 @@ bool ServerMap::saveBlock(MapBlock *block, MapDatabase *db)
|
||||
void ServerMap::loadBlock(const std::string §ordir, const std::string &blockfile,
|
||||
MapSector *sector, bool save_after_load)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
std::string fullpath = sectordir + DIR_DELIM + blockfile;
|
||||
try {
|
||||
std::ifstream is(fullpath.c_str(), std::ios_base::binary);
|
||||
@ -2069,8 +2045,6 @@ void ServerMap::loadBlock(const std::string §ordir, const std::string &block
|
||||
|
||||
void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool save_after_load)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
try {
|
||||
std::istringstream is(*blob, std::ios_base::binary);
|
||||
|
||||
@ -2132,8 +2106,6 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
|
||||
|
||||
MapBlock* ServerMap::loadBlock(v3s16 blockpos)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
bool created_new = (getBlockNoCreateNoEx(blockpos) == NULL);
|
||||
|
||||
v2s16 p2d(blockpos.X, blockpos.Z);
|
||||
|
@ -74,8 +74,6 @@ MeshUpdateQueue::~MeshUpdateQueue()
|
||||
|
||||
void MeshUpdateQueue::addBlock(Map *map, v3s16 p, bool ack_block_to_server, bool urgent)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
MutexAutoLock lock(m_mutex);
|
||||
|
||||
cleanupCache();
|
||||
|
@ -90,7 +90,6 @@ private:
|
||||
|
||||
void *ServerThread::run()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
m_server->AsyncRunStep(true);
|
||||
@ -367,8 +366,6 @@ Server::~Server()
|
||||
|
||||
void Server::start(Address bind_addr)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
m_bind_addr = bind_addr;
|
||||
|
||||
infostream<<"Starting server on "
|
||||
@ -400,8 +397,6 @@ void Server::start(Address bind_addr)
|
||||
|
||||
void Server::stop()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
infostream<<"Server: Stopping and waiting threads"<<std::endl;
|
||||
|
||||
// Stop threads (set run=false first so both start stopping)
|
||||
@ -415,7 +410,6 @@ void Server::stop()
|
||||
|
||||
void Server::step(float dtime)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
// Limit a bit
|
||||
if (dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
@ -437,8 +431,6 @@ void Server::step(float dtime)
|
||||
|
||||
void Server::AsyncRunStep(bool initial_step)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
g_profiler->add("Server::AsyncRunStep (num)", 1);
|
||||
|
||||
float dtime;
|
||||
@ -980,7 +972,6 @@ void Server::AsyncRunStep(bool initial_step)
|
||||
|
||||
void Server::Receive()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
u16 peer_id;
|
||||
try {
|
||||
NetworkPacket pkt;
|
||||
@ -1093,7 +1084,6 @@ inline void Server::handleCommand(NetworkPacket* pkt)
|
||||
|
||||
void Server::ProcessData(NetworkPacket *pkt)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
// Environment is locked first.
|
||||
MutexAutoLock envlock(m_env_mutex);
|
||||
|
||||
@ -1290,7 +1280,6 @@ void Server::SetBlocksNotSent(std::map<v3s16, MapBlock *>& block)
|
||||
|
||||
void Server::peerAdded(con::Peer *peer)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
verbosestream<<"Server::peerAdded(): peer->id="
|
||||
<<peer->id<<std::endl;
|
||||
|
||||
@ -1299,7 +1288,6 @@ void Server::peerAdded(con::Peer *peer)
|
||||
|
||||
void Server::deletingPeer(con::Peer *peer, bool timeout)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
verbosestream<<"Server::deletingPeer(): peer->id="
|
||||
<<peer->id<<", timeout="<<timeout<<std::endl;
|
||||
|
||||
@ -1396,7 +1384,6 @@ void Server::Send(NetworkPacket* pkt)
|
||||
|
||||
void Server::SendMovement(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
std::ostringstream os(std::ios_base::binary);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_MOVEMENT, 12 * sizeof(float), peer_id);
|
||||
@ -1433,8 +1420,6 @@ void Server::SendPlayerHPOrDie(PlayerSAO *playersao)
|
||||
|
||||
void Server::SendHP(u16 peer_id, u16 hp)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_HP, 1, peer_id);
|
||||
pkt << hp;
|
||||
Send(&pkt);
|
||||
@ -1442,8 +1427,6 @@ void Server::SendHP(u16 peer_id, u16 hp)
|
||||
|
||||
void Server::SendBreath(u16 peer_id, u16 breath)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_BREATH, 2, peer_id);
|
||||
pkt << (u16) breath;
|
||||
Send(&pkt);
|
||||
@ -1466,8 +1449,6 @@ void Server::SendAccessDenied(u16 peer_id, AccessDeniedCode reason,
|
||||
|
||||
void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_ACCESS_DENIED_LEGACY, 0, peer_id);
|
||||
pkt << reason;
|
||||
Send(&pkt);
|
||||
@ -1476,8 +1457,6 @@ void Server::SendAccessDenied_Legacy(u16 peer_id,const std::wstring &reason)
|
||||
void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
|
||||
v3f camera_point_target)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_DEATHSCREEN, 1 + sizeof(v3f), peer_id);
|
||||
pkt << set_camera_point_target << camera_point_target;
|
||||
Send(&pkt);
|
||||
@ -1486,8 +1465,6 @@ void Server::SendDeathscreen(u16 peer_id,bool set_camera_point_target,
|
||||
void Server::SendItemDef(u16 peer_id,
|
||||
IItemDefManager *itemdef, u16 protocol_version)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_ITEMDEF, 0, peer_id);
|
||||
|
||||
/*
|
||||
@ -1511,8 +1488,6 @@ void Server::SendItemDef(u16 peer_id,
|
||||
void Server::SendNodeDef(u16 peer_id,
|
||||
INodeDefManager *nodedef, u16 protocol_version)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_NODEDEF, 0, peer_id);
|
||||
|
||||
/*
|
||||
@ -1540,8 +1515,6 @@ void Server::SendNodeDef(u16 peer_id,
|
||||
|
||||
void Server::SendInventory(PlayerSAO* playerSAO)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
UpdateCrafting(playerSAO->getPlayer());
|
||||
|
||||
/*
|
||||
@ -1561,8 +1534,6 @@ void Server::SendInventory(PlayerSAO* playerSAO)
|
||||
|
||||
void Server::SendChatMessage(u16 peer_id, const ChatMessage &message)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket legacypkt(TOCLIENT_CHAT_MESSAGE_OLD, 0, peer_id);
|
||||
legacypkt << message.message;
|
||||
|
||||
@ -1588,8 +1559,6 @@ void Server::SendChatMessage(u16 peer_id, const ChatMessage &message)
|
||||
void Server::SendShowFormspecMessage(u16 peer_id, const std::string &formspec,
|
||||
const std::string &formname)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0 , peer_id);
|
||||
if (formspec.empty()){
|
||||
//the client should close the formspec
|
||||
@ -1610,7 +1579,6 @@ void Server::SendSpawnParticle(u16 peer_id, u16 protocol_version,
|
||||
bool vertical, const std::string &texture,
|
||||
const struct TileAnimationParams &animation, u8 glow)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
static thread_local const float radius =
|
||||
g_settings->getS16("max_block_send_distance") * MAP_BLOCKSIZE * BS;
|
||||
|
||||
@ -1662,7 +1630,6 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 protocol_version,
|
||||
u16 attached_id, bool vertical, const std::string &texture, u32 id,
|
||||
const struct TileAnimationParams &animation, u8 glow)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
if (peer_id == PEER_ID_INEXISTENT) {
|
||||
// This sucks and should be replaced:
|
||||
std::vector<u16> clients = m_clients.getClientIDs();
|
||||
@ -1701,8 +1668,6 @@ void Server::SendAddParticleSpawner(u16 peer_id, u16 protocol_version,
|
||||
|
||||
void Server::SendDeleteParticleSpawner(u16 peer_id, u32 id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_DELETE_PARTICLESPAWNER_LEGACY, 2, peer_id);
|
||||
|
||||
// Ugly error in this packet
|
||||
@ -1828,8 +1793,6 @@ void Server::SendOverrideDayNightRatio(u16 peer_id, bool do_override,
|
||||
|
||||
void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_TIME_OF_DAY, 0, peer_id);
|
||||
pkt << time << time_speed;
|
||||
|
||||
@ -1843,7 +1806,6 @@ void Server::SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed)
|
||||
|
||||
void Server::SendPlayerHP(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||
// In some rare case if the player is disconnected
|
||||
// while Lua call l_punch, for example, this can be NULL
|
||||
@ -1861,7 +1823,6 @@ void Server::SendPlayerHP(u16 peer_id)
|
||||
|
||||
void Server::SendPlayerBreath(PlayerSAO *sao)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
assert(sao);
|
||||
|
||||
m_script->player_event(sao, "breath_changed");
|
||||
@ -1870,7 +1831,6 @@ void Server::SendPlayerBreath(PlayerSAO *sao)
|
||||
|
||||
void Server::SendMovePlayer(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
RemotePlayer *player = m_env->getPlayer(peer_id);
|
||||
assert(player);
|
||||
PlayerSAO *sao = player->getPlayerSAO();
|
||||
@ -2194,8 +2154,6 @@ void Server::setBlockNotSent(v3s16 p)
|
||||
|
||||
void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
v3s16 p = block->getPos();
|
||||
|
||||
/*
|
||||
@ -2216,8 +2174,6 @@ void Server::SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto
|
||||
|
||||
void Server::SendBlocks(float dtime)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
MutexAutoLock envlock(m_env_mutex);
|
||||
//TODO check if one big lock could be faster then multiple small ones
|
||||
|
||||
@ -2282,8 +2238,6 @@ void Server::SendBlocks(float dtime)
|
||||
|
||||
void Server::fillMediaCache()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
infostream<<"Server: Calculating media file checksums"<<std::endl;
|
||||
|
||||
// Collect all media file paths
|
||||
@ -2379,8 +2333,6 @@ void Server::fillMediaCache()
|
||||
|
||||
void Server::sendMediaAnnouncement(u16 peer_id, const std::string &lang_code)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
verbosestream << "Server: Announcing files to id(" << peer_id << ")"
|
||||
<< std::endl;
|
||||
|
||||
@ -2425,8 +2377,6 @@ struct SendableMedia
|
||||
void Server::sendRequestedMedia(u16 peer_id,
|
||||
const std::vector<std::string> &tosend)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
verbosestream<<"Server::sendRequestedMedia(): "
|
||||
<<"Sending files to client"<<std::endl;
|
||||
|
||||
@ -2556,8 +2506,6 @@ void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
|
||||
|
||||
void Server::sendDetachedInventories(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
for (const auto &detached_inventory : m_detached_inventories) {
|
||||
const std::string &name = detached_inventory.first;
|
||||
//Inventory *inv = i->second;
|
||||
@ -2571,7 +2519,6 @@ void Server::sendDetachedInventories(u16 peer_id)
|
||||
|
||||
void Server::DiePlayer(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||
// In some rare cases this can be NULL -- if the player is disconnected
|
||||
// when a Lua function modifies l_punch, for example
|
||||
@ -2593,8 +2540,6 @@ void Server::DiePlayer(u16 peer_id)
|
||||
|
||||
void Server::RespawnPlayer(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
PlayerSAO *playersao = getPlayerSAO(peer_id);
|
||||
assert(playersao);
|
||||
|
||||
@ -2617,8 +2562,6 @@ void Server::RespawnPlayer(u16 peer_id)
|
||||
|
||||
void Server::DenySudoAccess(u16 peer_id)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
NetworkPacket pkt(TOCLIENT_DENY_SUDO_MODE, 0, peer_id);
|
||||
Send(&pkt);
|
||||
}
|
||||
@ -2643,8 +2586,6 @@ void Server::DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode
|
||||
|
||||
void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
SendAccessDenied(peer_id, reason, custom_reason);
|
||||
m_clients.event(peer_id, CSE_SetDenied);
|
||||
m_con->DisconnectPeer(peer_id);
|
||||
@ -2654,8 +2595,6 @@ void Server::DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string
|
||||
// the minimum version for MT users, maybe in 1 year
|
||||
void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
SendAccessDenied_Legacy(peer_id, reason);
|
||||
m_clients.event(peer_id, CSE_SetDenied);
|
||||
m_con->DisconnectPeer(peer_id);
|
||||
@ -2663,8 +2602,6 @@ void Server::DenyAccess_Legacy(u16 peer_id, const std::wstring &reason)
|
||||
|
||||
void Server::acceptAuth(u16 peer_id, bool forSudoMode)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
if (!forSudoMode) {
|
||||
RemoteClient* client = getClient(peer_id, CS_Invalid);
|
||||
|
||||
@ -2694,7 +2631,6 @@ void Server::acceptAuth(u16 peer_id, bool forSudoMode)
|
||||
|
||||
void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
std::wstring message;
|
||||
{
|
||||
/*
|
||||
@ -2770,8 +2706,6 @@ void Server::DeleteClient(u16 peer_id, ClientDeletionReason reason)
|
||||
|
||||
void Server::UpdateCrafting(RemotePlayer *player)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
// Get a preview for crafting
|
||||
ItemStack preview;
|
||||
InventoryLocation loc;
|
||||
@ -3608,8 +3542,6 @@ void Server::unregisterModStorage(const std::string &name)
|
||||
|
||||
void dedicated_server_loop(Server &server, bool &kill)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
verbosestream<<"dedicated_server_loop()"<<std::endl;
|
||||
|
||||
IntervalLimiter m_profiler_interval;
|
||||
|
@ -424,7 +424,6 @@ RemotePlayer *ServerEnvironment::getPlayer(const char* name)
|
||||
|
||||
void ServerEnvironment::addPlayer(RemotePlayer *player)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
/*
|
||||
Check that peer_ids are unique.
|
||||
Also check that names are unique.
|
||||
@ -1105,10 +1104,6 @@ void ServerEnvironment::clearObjects(ClearObjectsMode mode)
|
||||
|
||||
void ServerEnvironment::step(float dtime)
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
//TimeTaker timer("ServerEnv step");
|
||||
|
||||
/* Step time of day */
|
||||
stepTimeOfDay(dtime);
|
||||
|
||||
|
@ -119,8 +119,6 @@ fake_function() {
|
||||
gettext("Key for increasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||
gettext("View range decrease key");
|
||||
gettext("Key for decreasing the viewing range.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||
gettext("Print stacks");
|
||||
gettext("Key for printing debug stacks. Used for development.\nSee http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3");
|
||||
gettext("Network");
|
||||
gettext("Server address");
|
||||
gettext("Address to connect to.\nLeave this blank to start a local server.\nNote that the address field in the main menu overrides this setting.");
|
||||
|
@ -228,8 +228,6 @@ void TestGameDef::defineSomeNodes()
|
||||
|
||||
bool run_tests()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
|
||||
u64 t1 = porting::getTimeMs();
|
||||
TestGameDef gamedef;
|
||||
|
||||
|
@ -123,8 +123,6 @@ void TestConnection::testHelpers()
|
||||
|
||||
void TestConnection::testConnectSendReceive()
|
||||
{
|
||||
DSTACK("TestConnection::Run");
|
||||
|
||||
/*
|
||||
Test some real connections
|
||||
|
||||
|
@ -203,7 +203,6 @@ public:
|
||||
|
||||
void *run()
|
||||
{
|
||||
DSTACK(FUNCTION_NAME);
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
while (!stopRequested()) {
|
||||
|
Loading…
Reference in New Issue
Block a user