public void ReadCheck()
{
DateTime now = DateTime.Now;
TimeSpan elapsed = now - this.lastReadCheckTime;
if(!AllowReadCheck(elapsed))
{
Tracer.Debug("InactivityMonitor["+ instanceId +"]: A read check is not currently allowed.");
return;
}
this.lastReadCheckTime = now;
if(this.inRead.Value || this.failed.Value)
{
Tracer.DebugFormat("InactivityMonitor[{0}]: A receive is in progress or already failed.", instanceId);
return;
}
if(!commandReceived.Value)
{
Tracer.DebugFormat("InactivityMonitor[{0}]: No message received since last read check! Sending an InactivityException!", instanceId);
this.asyncErrorTask.IsPending = true;
this.asyncTasks.Wakeup();
}
else
{
commandReceived.Value = false;
}
}