HasBody() public method

public HasBody ( ) : bool
return bool
        public virtual ResolveResponseInfo Resolve(ResolveInfo resolveInfo)
        {
            if (resolveInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerNullResolveInfo"));
            }
            this.ThrowIfClosed("Resolve");
            if (!resolveInfo.HasBody())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { resolveInfo }));
            }
            int num          = 0;
            int num2         = 0;
            int maxAddresses = resolveInfo.MaxAddresses;
            ResolveResponseInfo      info      = new ResolveResponseInfo();
            List <PeerNodeAddress>   list      = new List <PeerNodeAddress>();
            List <RegistrationEntry> entryList = null;
            MeshEntry meshEntry = this.GetMeshEntry(resolveInfo.MeshId, false);

            if (meshEntry != null)
            {
                LiteLock liteLock = null;
                try
                {
                    LiteLock.Acquire(out liteLock, meshEntry.Gate);
                    entryList = meshEntry.EntryList;
                    if (entryList.Count <= maxAddresses)
                    {
                        foreach (RegistrationEntry entry3 in entryList)
                        {
                            list.Add(entry3.Address);
                        }
                    }
                    else
                    {
                        Random random = new Random();
                        while (num < maxAddresses)
                        {
                            num2 = random.Next(entryList.Count);
                            RegistrationEntry entry = entryList[num2];
                            PeerNodeAddress   item  = entry.Address;
                            if (!list.Contains(item))
                            {
                                list.Add(item);
                            }
                            num++;
                        }
                    }
                }
                finally
                {
                    LiteLock.Release(liteLock);
                }
            }
            info.Addresses = list.ToArray();
            return(info);
        }
        public virtual ResolveResponseInfo Resolve(ResolveInfo resolveInfo)
        {
            if (resolveInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", SR.GetString(SR.PeerNullResolveInfo));
            }

            ThrowIfClosed("Resolve");

            if (!resolveInfo.HasBody())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", SR.GetString(SR.PeerInvalidMessageBody, resolveInfo));
            }

            int currentCount = 0;
            int index = 0;
            int maxEntries = resolveInfo.MaxAddresses;
            ResolveResponseInfo response = new ResolveResponseInfo();
            List<PeerNodeAddress> results = new List<PeerNodeAddress>();
            List<RegistrationEntry> entries = null;
            PeerNodeAddress address;
            RegistrationEntry entry;
            MeshEntry meshEntry = GetMeshEntry(resolveInfo.MeshId, false);
            if (meshEntry != null)
            {
                LiteLock ll = null;
                try
                {
                    LiteLock.Acquire(out ll, meshEntry.Gate);
                    entries = meshEntry.EntryList;
                    if (entries.Count <= maxEntries)
                    {
                        foreach (RegistrationEntry e in entries)
                        {
                            results.Add(e.Address);
                        }
                    }
                    else
                    {
                        Random random = new Random();
                        while (currentCount < maxEntries)
                        {
                            index = random.Next(entries.Count);
                            entry = entries[index];
                            Fx.Assert(entry.State == RegistrationState.OK, "A deleted registration is still around!");
                            address = entry.Address;
                            if (!results.Contains(address))
                                results.Add(address);
                            currentCount++;
                        }
                    }
                }
                finally
                {
                    LiteLock.Release(ll);
                }
            }
            response.Addresses = results.ToArray();
            return response;
        }
        public virtual ResolveResponseInfo Resolve(ResolveInfo resolveInfo)
        {
            if (resolveInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", SR.GetString(SR.PeerNullResolveInfo));
            }

            ThrowIfClosed("Resolve");

            if (!resolveInfo.HasBody())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", SR.GetString(SR.PeerInvalidMessageBody, resolveInfo));
            }

            int currentCount = 0;
            int index        = 0;
            int maxEntries   = resolveInfo.MaxAddresses;
            ResolveResponseInfo      response = new ResolveResponseInfo();
            List <PeerNodeAddress>   results  = new List <PeerNodeAddress>();
            List <RegistrationEntry> entries  = null;
            PeerNodeAddress          address;
            RegistrationEntry        entry;
            MeshEntry meshEntry = GetMeshEntry(resolveInfo.MeshId, false);

            if (meshEntry != null)
            {
                LiteLock ll = null;
                try
                {
                    LiteLock.Acquire(out ll, meshEntry.Gate);
                    entries = meshEntry.EntryList;
                    if (entries.Count <= maxEntries)
                    {
                        foreach (RegistrationEntry e in entries)
                        {
                            results.Add(e.Address);
                        }
                    }
                    else
                    {
                        Random random = new Random();
                        while (currentCount < maxEntries)
                        {
                            index = random.Next(entries.Count);
                            entry = entries[index];
                            Fx.Assert(entry.State == RegistrationState.OK, "A deleted registration is still around!");
                            address = entry.Address;
                            if (!results.Contains(address))
                            {
                                results.Add(address);
                            }
                            currentCount++;
                        }
                    }
                }
                finally
                {
                    LiteLock.Release(ll);
                }
            }
            response.Addresses = results.ToArray();
            return(response);
        }
 public virtual ResolveResponseInfo Resolve(ResolveInfo resolveInfo)
 {
     if (resolveInfo == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerNullResolveInfo"));
     }
     this.ThrowIfClosed("Resolve");
     if (!resolveInfo.HasBody())
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { resolveInfo }));
     }
     int num = 0;
     int num2 = 0;
     int maxAddresses = resolveInfo.MaxAddresses;
     ResolveResponseInfo info = new ResolveResponseInfo();
     List<PeerNodeAddress> list = new List<PeerNodeAddress>();
     List<RegistrationEntry> entryList = null;
     MeshEntry meshEntry = this.GetMeshEntry(resolveInfo.MeshId, false);
     if (meshEntry != null)
     {
         LiteLock liteLock = null;
         try
         {
             LiteLock.Acquire(out liteLock, meshEntry.Gate);
             entryList = meshEntry.EntryList;
             if (entryList.Count <= maxAddresses)
             {
                 foreach (RegistrationEntry entry3 in entryList)
                 {
                     list.Add(entry3.Address);
                 }
             }
             else
             {
                 Random random = new Random();
                 while (num < maxAddresses)
                 {
                     num2 = random.Next(entryList.Count);
                     RegistrationEntry entry = entryList[num2];
                     PeerNodeAddress item = entry.Address;
                     if (!list.Contains(item))
                     {
                         list.Add(item);
                     }
                     num++;
                 }
             }
         }
         finally
         {
             LiteLock.Release(liteLock);
         }
     }
     info.Addresses = list.ToArray();
     return info;
 }