WebSocketServer: Rename sessionDuration to connectedAt

This commit is contained in:
tt2468 2021-04-28 11:14:00 -07:00
parent 0af2724ee9
commit 11913dac76
2 changed files with 5 additions and 4 deletions

View File

@ -42,10 +42,10 @@ class WebSocketServer
MsgPack
};
struct WebSocketState {
struct WebSocketSessionState {
websocketpp::connection_hdl hdl;
std::string remoteAddress;
uint64_t durationSeconds;
uint64_t connectedAt;
uint64_t incomingMessages;
uint64_t outgoingMessages;
};
@ -61,7 +61,7 @@ class WebSocketServer
return _server.is_listening();
}
std::vector<WebSocketState> GetWebSocketSessions();
std::vector<WebSocketSessionState> GetWebSocketSessions();
QThreadPool *GetThreadPool() {
return &_threadPool;

View File

@ -77,7 +77,8 @@ void SettingsDialog::FillSessionTable()
QTableWidgetItem *addressItem = new QTableWidgetItem(QString::fromStdString(session.remoteAddress));
ui->websocketSessionTable->setItem(i, 0, addressItem);
QTableWidgetItem *durationItem = new QTableWidgetItem(QTime(0, 0, session.durationSeconds).toString("hh:mm:ss"));
uint64_t sessionDuration = QDateTime::toTime_t() - session.connectedAt;
QTableWidgetItem *durationItem = new QTableWidgetItem(QTime(0, 0, sessionDuration).toString("hh:mm:ss"));
ui->websocketSessionTable->setItem(i, 1, durationItem);
QTableWidgetItem *statsItem = new QTableWidgetItem(QString("%1/%2").arg(session.incomingMessages).arg(session.outgoingMessages));