diff --git a/common/network/GetAPI.h b/common/network/GetAPI.h index c7c07b4..12d07b5 100644 --- a/common/network/GetAPI.h +++ b/common/network/GetAPI.h @@ -37,6 +37,7 @@ namespace network { // from main thread void mainUpdateScreen(rfb::PixelBuffer *pb); void mainUpdateBottleneckStats(const char userid[], const char stats[]); + void mainClearBottleneckStats(const char userid[]); void mainUpdateServerFrameStats(uint8_t changedPerc, uint32_t all, uint32_t jpeg, uint32_t webp, uint32_t analysis, uint32_t jpegarea, uint32_t webparea, diff --git a/common/network/GetAPIMessager.cxx b/common/network/GetAPIMessager.cxx index 3ce2675..9ea19bc 100644 --- a/common/network/GetAPIMessager.cxx +++ b/common/network/GetAPIMessager.cxx @@ -110,6 +110,15 @@ void GetAPIMessager::mainUpdateBottleneckStats(const char userid[], const char s pthread_mutex_unlock(&statMutex); } +void GetAPIMessager::mainClearBottleneckStats(const char userid[]) { + if (pthread_mutex_trylock(&statMutex)) + return; + + bottleneckStats.erase(userid); + + pthread_mutex_unlock(&statMutex); +} + void GetAPIMessager::mainUpdateServerFrameStats(uint8_t changedPerc, uint32_t all, uint32_t jpeg, uint32_t webp, uint32_t analysis, uint32_t jpegarea, uint32_t webparea, diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index aa2314c..a70b9b5 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -133,8 +133,10 @@ VNCSConnectionST::~VNCSConnectionST() delete [] fenceData; - if (server->apimessager) + if (server->apimessager) { server->apimessager->mainUpdateUserInfo(checkOwnerConn(), server->clients.size()); + server->apimessager->mainClearBottleneckStats(peerEndpoint.buf); + } }