HasBody() public method

public HasBody ( ) : bool
return bool
        public virtual RegisterResponseInfo Update(UpdateInfo updateInfo)
        {
            if (updateInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", SR.GetString(SR.PeerNullRegistrationInfo));
            }

            ThrowIfClosed("Update");

            if (!updateInfo.HasBody() || String.IsNullOrEmpty(updateInfo.MeshId) || updateInfo.NodeAddress == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", SR.GetString(SR.PeerInvalidMessageBody, updateInfo));
            }

            Guid registrationId = updateInfo.RegistrationId;
            RegistrationEntry entry;

            MeshEntry meshEntry = GetMeshEntry(updateInfo.MeshId);
            LiteLock  ll        = null;

            //handle cases when Update ----s with Register.
            if (updateInfo.RegistrationId == Guid.Empty || meshEntry == null)
            {
                return(Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress));
            }
            //
            // preserve locking order between ThisLock and the LiteLock.
            lock (ThisLock)
            {
                try
                {
                    LiteLock.Acquire(out ll, meshEntry.Gate);
                    if (!meshEntry.EntryTable.TryGetValue(updateInfo.RegistrationId, out entry))
                    {
                        try
                        {
                            // upgrade to writer lock
                            ll.UpgradeToWriterLock();
                            return(Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress));
                        }
                        finally
                        {
                            ll.DowngradeFromWriterLock();
                        }
                    }
                    lock (entry)
                    {
                        entry.Address = updateInfo.NodeAddress;
                        entry.Expires = DateTime.UtcNow + this.RefreshInterval;
                    }
                }
                finally
                {
                    LiteLock.Release(ll);
                }
            }
            return(new RegisterResponseInfo(registrationId, RefreshInterval));
        }
        public virtual RegisterResponseInfo Update(UpdateInfo updateInfo)
        {
            if (updateInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
            }
            this.ThrowIfClosed("Update");
            if ((!updateInfo.HasBody() || string.IsNullOrEmpty(updateInfo.MeshId)) || (updateInfo.NodeAddress == null))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { updateInfo }));
            }
            Guid      registrationId = updateInfo.RegistrationId;
            MeshEntry meshEntry      = this.GetMeshEntry(updateInfo.MeshId);
            LiteLock  liteLock       = null;

            if ((updateInfo.RegistrationId == Guid.Empty) || (meshEntry == null))
            {
                return(this.Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress));
            }
            try
            {
                RegistrationEntry entry;
                LiteLock.Acquire(out liteLock, meshEntry.Gate);
                if (!meshEntry.EntryTable.TryGetValue(updateInfo.RegistrationId, out entry))
                {
                    return(this.Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress));
                }
                lock (entry)
                {
                    entry.Address = updateInfo.NodeAddress;
                    entry.Expires = DateTime.UtcNow + this.RefreshInterval;
                }
            }
            finally
            {
                LiteLock.Release(liteLock);
            }
            return(new RegisterResponseInfo(registrationId, this.RefreshInterval));
        }
        public virtual RegisterResponseInfo Update(UpdateInfo updateInfo)
        {
            if (updateInfo == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", SR.GetString(SR.PeerNullRegistrationInfo));
            }

            ThrowIfClosed("Update");

            if (!updateInfo.HasBody() || String.IsNullOrEmpty(updateInfo.MeshId) || updateInfo.NodeAddress == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", SR.GetString(SR.PeerInvalidMessageBody, updateInfo));
            }

            Guid registrationId = updateInfo.RegistrationId;
            RegistrationEntry entry;

            MeshEntry meshEntry = GetMeshEntry(updateInfo.MeshId);
            LiteLock ll = null;

            //handle cases when Update ----s with Register.
            if (updateInfo.RegistrationId == Guid.Empty || meshEntry == null)
                return Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress);
            //
            // preserve locking order between ThisLock and the LiteLock.
            lock (ThisLock)
            {
                try
                {
                    LiteLock.Acquire(out ll, meshEntry.Gate);
                    if (!meshEntry.EntryTable.TryGetValue(updateInfo.RegistrationId, out entry))
                    {
                        try
                        {
                            // upgrade to writer lock
                            ll.UpgradeToWriterLock();
                            return Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress);
                        }
                        finally
                        {
                            ll.DowngradeFromWriterLock();
                        }
                    }
                    lock (entry)
                    {
                        entry.Address = updateInfo.NodeAddress;
                        entry.Expires = DateTime.UtcNow + this.RefreshInterval;
                    }
                }
                finally
                {
                    LiteLock.Release(ll);
                }
            }
            return new RegisterResponseInfo(registrationId, RefreshInterval);
        }
 public virtual RegisterResponseInfo Update(UpdateInfo updateInfo)
 {
     if (updateInfo == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo"));
     }
     this.ThrowIfClosed("Update");
     if ((!updateInfo.HasBody() || string.IsNullOrEmpty(updateInfo.MeshId)) || (updateInfo.NodeAddress == null))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("updateInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { updateInfo }));
     }
     Guid registrationId = updateInfo.RegistrationId;
     MeshEntry meshEntry = this.GetMeshEntry(updateInfo.MeshId);
     LiteLock liteLock = null;
     if ((updateInfo.RegistrationId == Guid.Empty) || (meshEntry == null))
     {
         return this.Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress);
     }
     try
     {
         RegistrationEntry entry;
         LiteLock.Acquire(out liteLock, meshEntry.Gate);
         if (!meshEntry.EntryTable.TryGetValue(updateInfo.RegistrationId, out entry))
         {
             return this.Register(updateInfo.ClientId, updateInfo.MeshId, updateInfo.NodeAddress);
         }
         lock (entry)
         {
             entry.Address = updateInfo.NodeAddress;
             entry.Expires = DateTime.UtcNow + this.RefreshInterval;
         }
     }
     finally
     {
         LiteLock.Release(liteLock);
     }
     return new RegisterResponseInfo(registrationId, this.RefreshInterval);
 }