private void ProcessOutbox() { if (_outbox.Count == 0 || !_sendAcks) { return; } ushort seqId; OutboxItem outboxItem; lock (_outboxLock) { foreach (var p in _outbox) { seqId = p.Key; outboxItem = p.Value; if (outboxItem.lastSendTime < DateTime.UtcNow.Ticks - 10000000) { outboxItem.lastSendTime = DateTime.UtcNow.Ticks; InternalChannel.Send(outboxItem.data); } } } }
private void ProcessOutbox() { if (_outbox.Count == 0 || !_sendAcks) { return; } ushort seqId; OutboxItem outboxItem; lock (_outboxLock) { foreach (var p in _outbox) { seqId = p.Key; outboxItem = p.Value; if (outboxItem.nextSendTime < DateTime.UtcNow.Ticks) { outboxItem.nextSendTime = DateTime.UtcNow.Ticks + ACK_TIMEOUT_DURATION_IN_TICKS * (1 + (_outbox.Count / ACK_TIMEOUT_INCREMENT_PER_MESSAGE_COUNT)); InternalChannel.Send(outboxItem.data); } } } }
public override void Send(byte[] data) { InternalChannel.Send(data); ProcessOutbox(); }