not scheduled, as well as the transmit list being empty.
schedule(sendEvent, std::max(nextReady, curTick + 1));
} else {
// no more to send right now: if we're draining, we may be done
- if (drainEvent) {
+ if (drainEvent && !sendEvent->scheduled()) {
drainEvent->process();
drainEvent = NULL;
}
schedule(sendEvent, time <= curTick ? curTick+1 : time);
}
- if (transmitList.empty() && drainEvent) {
+ if (transmitList.empty() && drainEvent && !sendEvent->scheduled()) {
drainEvent->process();
drainEvent = NULL;
}
unsigned int
SimpleTimingPort::drain(Event *de)
{
- if (transmitList.size() == 0)
+ if (transmitList.size() == 0 && !sendEvent->scheduled())
return 0;
drainEvent = de;
return 1;