예제 #1
0
 public bool IsNotSeenBefore(Message message, out byte[] id, out int cacheHit)
 {
     cacheHit = -1;
     id       = PeerNodeImplementation.DefaultId;
     if (message is SecurityVerifiedMessage)
     {
         id = (message as SecurityVerifiedMessage).PrimarySignatureValue;
     }
     else
     {
         System.Xml.UniqueId messageId = PeerMessageHelpers.GetHeaderUniqueId(message.Headers, PeerStrings.MessageId, PeerStrings.Namespace);
         if (messageId == null)
         {
             return(false);
         }
         if (messageId.IsGuid)
         {
             id = new byte[16];
             messageId.TryGetGuid(id, 0);
         }
         else
         {
             return(false);
         }
     }
     cacheHit = messageIds.AddForLookup(id);
     if (cacheHit == -1)
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
 public bool IsNotSeenBefore(Message message, out byte[] id, out int cacheHit)
 {
     cacheHit = -1;
     id       = PeerNodeImplementation.DefaultId;
     if (message is SecurityVerifiedMessage)
     {
         id = (message as SecurityVerifiedMessage).PrimarySignatureValue;
     }
     else
     {
         UniqueId id2 = PeerMessageHelpers.GetHeaderUniqueId(message.Headers, "MessageID", "http://schemas.microsoft.com/net/2006/05/peer");
         if ((id2 != null) && id2.IsGuid)
         {
             id = new byte[0x10];
             id2.TryGetGuid(id, 0);
         }
         else
         {
             return(false);
         }
     }
     cacheHit = this.messageIds.AddForLookup(id);
     return(cacheHit == -1);
 }