Author: cgutman
Date: Sun Jun 6 21:18:19 2010
New Revision: 47636
URL:
http://svn.reactos.org/svn/reactos?rev=47636&view=rev
Log:
[NDIS]
- Only dequeue the timer in the DPC if the Period is 0 (which means that it's NOT a
periodic timer so we only get called once)
- Attempt to dequeue the timer before inserting it so we don't end up with multiple
copies of the same timer on the timer queue if somebody calls NdisMSet(Periodic)Timer
twice
Modified:
trunk/reactos/drivers/network/ndis/ndis/time.c
Modified: trunk/reactos/drivers/network/ndis/ndis/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/time.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/time.c [iso-8859-1] Sun Jun 6 21:18:19 2010
@@ -95,7 +95,7 @@
KeInitializeDpc (&Timer->Dpc, (PKDEFERRED_ROUTINE)TimerFunction,
FunctionContext);
}
-VOID DequeueMiniportTimer(PNDIS_MINIPORT_TIMER Timer)
+BOOLEAN DequeueMiniportTimer(PNDIS_MINIPORT_TIMER Timer)
{
PNDIS_MINIPORT_TIMER CurrentTimer;
@@ -104,6 +104,8 @@
if (Timer->Miniport->TimerQueue == Timer)
{
Timer->Miniport->TimerQueue = Timer->NextDeferredTimer;
+ Timer->NextDeferredTimer = NULL;
+ return TRUE;
}
else
{
@@ -113,11 +115,12 @@
if (CurrentTimer->NextDeferredTimer == Timer)
{
CurrentTimer->NextDeferredTimer = Timer->NextDeferredTimer;
- return;
+ Timer->NextDeferredTimer = NULL;
+ return TRUE;
}
CurrentTimer = CurrentTimer->NextDeferredTimer;
}
- ASSERT(FALSE);
+ return FALSE;
}
}
@@ -161,8 +164,8 @@
SystemArgument1,
SystemArgument2);
- /* FIXME: We can't call this if we have a periodic timer */
- //DequeueMiniportTimer(Timer);
+ /* Only dequeue if the timer has a period of 0 */
+ if (!Timer->Timer.Period) DequeueMiniportTimer(Timer);
}
@@ -227,6 +230,9 @@
/* relative delays are negative, absolute are positive; resolution is 100ns */
Timeout.QuadPart = Int32x32To64(MillisecondsPeriod, -10000);
+ /* Dequeue the timer if it is queued already */
+ DequeueMiniportTimer(Timer);
+
/* Add the timer at the head of the timer queue */
Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;
Timer->Miniport->TimerQueue = Timer;
@@ -261,6 +267,9 @@
/* relative delays are negative, absolute are positive; resolution is 100ns */
Timeout.QuadPart = Int32x32To64(MillisecondsToDelay, -10000);
+
+ /* Dequeue the timer if it is queued already */
+ DequeueMiniportTimer(Timer);
/* Add the timer at the head of the timer queue */
Timer->NextDeferredTimer = Timer->Miniport->TimerQueue;