/// <summary>Processe content in sequence</summary> private void ProcessSequencedContent() { // Retrieve the expected sequence content if (Cached.Contains(ExpectedSequence)) { // Delivery and remove from cache var content = Cached[ExpectedSequence]; Cached.Remove(ExpectedSequence); // Clear old sequence var sequence = (ushort)((ExpectedSequence - 100) + 0xFFFF); Acks.Remove((ushort)(sequence % 0xFFFF)); // Next expected sequence NextExpectedSequence(); if (Link.DoReason(content)) { return; } if (Link.DoFailure(content)) { return; } if (Link.DoMatch(content)) { return; } if (Link.DoRedirect(content)) { return; } if (Link.DoApproval(content)) { return; } if (Link.DoAccepted(content)) { return; } if (Link.DoDenied(content)) { return; } if (Link.DoData(content)) { return; } // Unknown content Network.Raise(EventType.Failed, Failure.Unknown, Link); } }
/// <summary>Do RESPONSE</summary> /// <param name="content">Content</param> /// <returns>True if RESPONSE</returns> private bool DoResponse(Content content) { if (content.Protocol != Content.RESPONSE) { return(false); } // Measure latency Link.MeasureLatency(content.Timestamp); // Recycles and removes the content if (Contents.Contains(content.Identifier)) { // Attempts Attempts.Remove(content.Identifier); // Contents Contents.Remove(content.Identifier); } return(true); }
/// <summary>Unlink a network address to a link</summary> /// <param name="endPoint">Network address</param> internal void Unlinked(EndPoint endPoint) { LinksByEndPoint.Remove(endPoint); }