Clear disconnected clients from the bottleneck stats api

This commit is contained in:
Lauri Kasanen 2021-08-02 12:45:51 +03:00
parent fae8aa9051
commit c1ed769780
3 changed files with 13 additions and 1 deletions

View File

@ -37,6 +37,7 @@ namespace network {
// from main thread // from main thread
void mainUpdateScreen(rfb::PixelBuffer *pb); void mainUpdateScreen(rfb::PixelBuffer *pb);
void mainUpdateBottleneckStats(const char userid[], const char stats[]); void mainUpdateBottleneckStats(const char userid[], const char stats[]);
void mainClearBottleneckStats(const char userid[]);
void mainUpdateServerFrameStats(uint8_t changedPerc, uint32_t all, void mainUpdateServerFrameStats(uint8_t changedPerc, uint32_t all,
uint32_t jpeg, uint32_t webp, uint32_t analysis, uint32_t jpeg, uint32_t webp, uint32_t analysis,
uint32_t jpegarea, uint32_t webparea, uint32_t jpegarea, uint32_t webparea,

View File

@ -110,6 +110,15 @@ void GetAPIMessager::mainUpdateBottleneckStats(const char userid[], const char s
pthread_mutex_unlock(&statMutex); 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, void GetAPIMessager::mainUpdateServerFrameStats(uint8_t changedPerc,
uint32_t all, uint32_t jpeg, uint32_t webp, uint32_t analysis, uint32_t all, uint32_t jpeg, uint32_t webp, uint32_t analysis,
uint32_t jpegarea, uint32_t webparea, uint32_t jpegarea, uint32_t webparea,

View File

@ -133,8 +133,10 @@ VNCSConnectionST::~VNCSConnectionST()
delete [] fenceData; delete [] fenceData;
if (server->apimessager) if (server->apimessager) {
server->apimessager->mainUpdateUserInfo(checkOwnerConn(), server->clients.size()); server->apimessager->mainUpdateUserInfo(checkOwnerConn(), server->clients.size());
server->apimessager->mainClearBottleneckStats(peerEndpoint.buf);
}
} }