diff --git a/include/transport/networkpluginserver.h b/include/transport/networkpluginserver.h index 671c8ba4d60332cef309189b526e87a5e12c9703..e0ce31f9aa8b3529c792b69345568290881a935b 100644 --- a/include/transport/networkpluginserver.h +++ b/include/transport/networkpluginserver.h @@ -56,6 +56,7 @@ class NetworkPluginServer { bool acceptUsers; bool longRun; bool willDie; + std::string id; }; NetworkPluginServer(Component *component, Config *config, UserManager *userManager, FileTransferManager *ftManager); diff --git a/include/transport/protocol.proto b/include/transport/protocol.proto index 9a296392cb37f84a6c726e56ee8d3fa378534564..8f3ac42c98a3909e6c95ba234aa22a68835e6ef5 100644 --- a/include/transport/protocol.proto +++ b/include/transport/protocol.proto @@ -106,6 +106,7 @@ message Stats { required int32 res = 1; required int32 init_res = 2; required int32 shared = 3; + required string id = 4; } message File { diff --git a/plugin/cpp/networkplugin.cpp b/plugin/cpp/networkplugin.cpp index c17adb7fb3d2983afe01b952ac81a46b9b4f3aeb..4c26515af81b5c16d8a68470e6d877ce603a1620 100644 --- a/plugin/cpp/networkplugin.cpp +++ b/plugin/cpp/networkplugin.cpp @@ -41,6 +41,12 @@ namespace Transport { wrap.set_payload(MESSAGE); \ wrap.SerializeToString(&MESSAGE); +template std::string stringOf(T object) { + std::ostringstream os; + os << object; + return (os.str()); +} + NetworkPlugin::NetworkPlugin() { m_pingReceived = false; @@ -603,6 +609,8 @@ void NetworkPlugin::sendMemoryUsage() { std::string message; stats.SerializeToString(&message); + stats.set_id(stringOf(getpid())); + WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_STATS); send(message); diff --git a/src/networkpluginserver.cpp b/src/networkpluginserver.cpp index 5beba0027532518518ecf69828eb3aeb20e2a81f..f3f891f07f8b6e5b18ddbcbc8c63d07322b19bcc 100644 --- a/src/networkpluginserver.cpp +++ b/src/networkpluginserver.cpp @@ -612,6 +612,7 @@ void NetworkPluginServer::handleStatsPayload(Backend *c, const std::string &data c->res = payload.res(); c->init_res = payload.init_res(); c->shared = payload.shared(); + c->id = payload.id(); } void NetworkPluginServer::handleFTStartPayload(const std::string &data) {