diff --git a/core/plug-in/stats/Statistics.cpp b/core/plug-in/stats/Statistics.cpp index 5a3cefd8..f4a80183 100644 --- a/core/plug-in/stats/Statistics.cpp +++ b/core/plug-in/stats/Statistics.cpp @@ -36,6 +36,15 @@ StatsFactory::StatsFactory(const std::string& _app_name) { } +StatsFactory::~StatsFactory() +{ + StatsUDPServer* stat_srv = StatsUDPServer::instance(); + if (stat_srv) { + stat_srv->stop(); + stat_srv->join(); + } +} + int StatsFactory::onLoad() { StatsUDPServer* stat_srv = StatsUDPServer::instance(); diff --git a/core/plug-in/stats/Statistics.h b/core/plug-in/stats/Statistics.h index 8803e85e..f8c7dbd4 100644 --- a/core/plug-in/stats/Statistics.h +++ b/core/plug-in/stats/Statistics.h @@ -35,7 +35,8 @@ class StatsFactory: public AmPluginFactory { public: StatsFactory(const std::string& _app_name); - + ~StatsFactory(); + // AmPluginFactory interface int onLoad(); };