mirror of
https://github.com/tnodir/fort
synced 2024-11-15 11:35:07 +00:00
Driver: fortstat: Simplify fort_flow_delete()
This commit is contained in:
parent
9ef48719ac
commit
c5d78becce
@ -527,22 +527,27 @@ FORT_API NTSTATUS fort_flow_associate(PFORT_STAT stat, UINT64 flow_id, UINT32 pr
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL fort_flow_delete_closing(PFORT_STAT stat)
|
||||||
|
{
|
||||||
|
if ((fort_stat_flags(stat) & FORT_STAT_CLOSED) != 0) {
|
||||||
|
InterlockedDecrement(&stat->flow_closing_count);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
FORT_API void fort_flow_delete(PFORT_STAT stat, UINT64 flowContext)
|
FORT_API void fort_flow_delete(PFORT_STAT stat, UINT64 flowContext)
|
||||||
{
|
{
|
||||||
PFORT_FLOW flow = (PFORT_FLOW) flowContext;
|
PFORT_FLOW flow = (PFORT_FLOW) flowContext;
|
||||||
|
|
||||||
if ((fort_stat_flags(stat) & FORT_STAT_CLOSED) != 0) {
|
if (fort_flow_delete_closing(stat))
|
||||||
InterlockedDecrement(&stat->flow_closing_count);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
KLOCK_QUEUE_HANDLE lock_queue;
|
KLOCK_QUEUE_HANDLE lock_queue;
|
||||||
KeAcquireInStackQueuedSpinLock(&stat->lock, &lock_queue);
|
KeAcquireInStackQueuedSpinLock(&stat->lock, &lock_queue);
|
||||||
|
|
||||||
/* Double check for locked flows */
|
/* Double check for locked flows */
|
||||||
if ((fort_stat_flags(stat) & FORT_STAT_CLOSED) != 0) {
|
if (!fort_flow_delete_closing(stat)) {
|
||||||
InterlockedDecrement(&stat->flow_closing_count);
|
|
||||||
} else {
|
|
||||||
fort_flow_free(stat, flow);
|
fort_flow_free(stat, flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user