mirror of
https://github.com/tnodir/fort
synced 2024-11-15 15:48:03 +00:00
UI: Statistics: Fix traffic updating for new app, after it was blocked.
This commit is contained in:
parent
c8ef46ee4b
commit
09413876e4
@ -348,7 +348,7 @@ bool StatManager::logBlockedIp(const LogEntryBlockedIp &entry, qint64 unixTime)
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
sqliteDb()->beginTransaction();
|
sqliteDb()->beginTransaction();
|
||||||
|
|
||||||
const qint64 appId = getOrCreateAppId(entry.path(), unixTime, true);
|
const qint64 appId = getOrCreateAppId(entry.path(), unixTime);
|
||||||
if (appId != INVALID_APP_ID) {
|
if (appId != INVALID_APP_ID) {
|
||||||
ok = createConnBlock(entry, unixTime, appId);
|
ok = createConnBlock(entry, unixTime, appId);
|
||||||
}
|
}
|
||||||
@ -492,7 +492,7 @@ qint64 StatManager::createAppId(const QString &appPath, qint64 unixTime)
|
|||||||
return INVALID_APP_ID;
|
return INVALID_APP_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 StatManager::getOrCreateAppId(const QString &appPath, qint64 unixTime, bool blocked)
|
qint64 StatManager::getOrCreateAppId(const QString &appPath, qint64 unixTime)
|
||||||
{
|
{
|
||||||
qint64 appId = getCachedAppId(appPath);
|
qint64 appId = getCachedAppId(appPath);
|
||||||
if (appId == INVALID_APP_ID) {
|
if (appId == INVALID_APP_ID) {
|
||||||
@ -506,10 +506,6 @@ qint64 StatManager::getOrCreateAppId(const QString &appPath, qint64 unixTime, bo
|
|||||||
|
|
||||||
Q_ASSERT(appId != INVALID_APP_ID);
|
Q_ASSERT(appId != INVALID_APP_ID);
|
||||||
|
|
||||||
if (!blocked && !hasAppTraf(appId)) {
|
|
||||||
emit appCreated(appId, appPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
addCachedAppId(appPath, appId);
|
addCachedAppId(appPath, appId);
|
||||||
}
|
}
|
||||||
return appId;
|
return appId;
|
||||||
@ -593,6 +589,10 @@ void StatManager::logTrafBytes(const QStmtList &insertStmtList, const QStmtList
|
|||||||
Q_ASSERT(appId != INVALID_APP_ID);
|
Q_ASSERT(appId != INVALID_APP_ID);
|
||||||
|
|
||||||
if (m_isActivePeriod) {
|
if (m_isActivePeriod) {
|
||||||
|
if (!hasAppTraf(appId)) {
|
||||||
|
emit appCreated(appId, appPath);
|
||||||
|
}
|
||||||
|
|
||||||
// Update or insert app bytes
|
// Update or insert app bytes
|
||||||
updateTrafficList(insertStmtList, updateStmtList, inBytes, outBytes, appId);
|
updateTrafficList(insertStmtList, updateStmtList, inBytes, outBytes, appId);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ private:
|
|||||||
|
|
||||||
qint64 getAppId(const QString &appPath);
|
qint64 getAppId(const QString &appPath);
|
||||||
qint64 createAppId(const QString &appPath, qint64 unixTime);
|
qint64 createAppId(const QString &appPath, qint64 unixTime);
|
||||||
qint64 getOrCreateAppId(const QString &appPath, qint64 unixTime = 0, bool blocked = false);
|
qint64 getOrCreateAppId(const QString &appPath, qint64 unixTime = 0);
|
||||||
bool deleteAppId(qint64 appId);
|
bool deleteAppId(qint64 appId);
|
||||||
|
|
||||||
void deleteOldTraffic(qint32 trafHour);
|
void deleteOldTraffic(qint32 trafHour);
|
||||||
|
Loading…
Reference in New Issue
Block a user