From b9eabad70160eafdef8e691bbde0a711a95b1c20 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 2 Dec 2012 16:55:06 +0200 Subject: [PATCH 1/1] Lot of debug output for rscriptd. --- projects/rscriptd/listener.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/projects/rscriptd/listener.cpp b/projects/rscriptd/listener.cpp index 2761d7f7..ead5d33b 100644 --- a/projects/rscriptd/listener.cpp +++ b/projects/rscriptd/listener.cpp @@ -356,35 +356,58 @@ while (it != pending.end() && count < 256) ); if (it->type == PendingData::CONNECT) { + printfd(__FILE__, "Connect packet\n"); if (uit == users.end() || uit->login != it->login) { + printfd(__FILE__, "Connect new user '%s'\n", it->login.c_str()); // Add new user Connect(*it); users.insert(uit, AliveData(static_cast(*it))); } else if (uit->login == it->login) { + printfd(__FILE__, "Update existing user '%s'\n", it->login.c_str()); // Update already existing user time(&uit->lastAlive); uit->params = it->params; } + else + { + printfd(__FILE__, "Hmmm... Strange connect for '%s'\n", it->login.c_str()); + } } else if (it->type == PendingData::ALIVE) { + printfd(__FILE__, "Alive packet\n"); if (uit != users.end() && uit->login == it->login) { + printfd(__FILE__, "Alive user '%s'\n", it->login.c_str()); // Update existing user time(&uit->lastAlive); } + else + { + printfd(__FILE__, "Alive user '%s' is not found\n", it->login.c_str()); + } } else if (it->type == PendingData::DISCONNECT) { + printfd(__FILE__, "Disconnect packet\n"); if (uit != users.end() && uit->login == it->login.c_str()) { + printfd(__FILE__, "Disconnect user '%s'\n", it->login.c_str()); // Disconnect existing user Disconnect(*uit); users.erase(uit); } + else + { + printfd(__FILE__, "Cannot find user '%s' for disconnect\n", it->login.c_str()); + } + } + else + { + printfd(__FILE__, "Unknown packet type\n"); } ++it; ++count; -- 2.44.2