protected virtual IAsyncResult BeginFloodReceivedMessage(IPeerNeighbor sender, MessageBuffer messageBuffer, TimeSpan timeout, AsyncCallback callback, object state, int index, MessageHeader hopHeader)
 {
     this.quotaHelper.AcquireNoQueue();
     try
     {
         return(this.FloodMessageToNeighbors(messageBuffer, timeout, callback, state, index, hopHeader, sender, this.OnMessageSentHandler));
     }
     catch (Exception exception)
     {
         if (Fx.IsFatal(exception))
         {
             throw;
         }
         if (!(exception is QuotaExceededException) && (!(exception is CommunicationException) || !(exception.InnerException is QuotaExceededException)))
         {
             throw;
         }
         System.ServiceModel.DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
         if (System.ServiceModel.DiagnosticUtility.ShouldTraceError)
         {
             PeerFlooderTraceRecord extendedData = new PeerFlooderTraceRecord(this.config.MeshId, sender.ListenAddress, exception);
             TraceUtility.TraceEvent(TraceEventType.Error, 0x4004f, System.ServiceModel.SR.GetString("TraceCodePeerFlooderReceiveMessageQuotaExceeded"), extendedData, this, null);
         }
         return(null);
     }
 }
Ejemplo n.º 2
0
        protected virtual IAsyncResult BeginFloodReceivedMessage(IPeerNeighbor sender, MessageBuffer messageBuffer,
                                                                 TimeSpan timeout, AsyncCallback callback, object state, int index, MessageHeader hopHeader)
        {
            quotaHelper.AcquireNoQueue();

            try
            {
                return(FloodMessageToNeighbors(messageBuffer, timeout, callback, state, index, hopHeader, sender, OnMessageSentHandler));
            }
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }
                if (e is QuotaExceededException || (e is CommunicationException && e.InnerException is QuotaExceededException))
                {
                    DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
                    if (DiagnosticUtility.ShouldTraceError)
                    {
                        PeerFlooderTraceRecord record = new PeerFlooderTraceRecord(
                            this.config.MeshId,
                            sender.ListenAddress,
                            e);
                        TraceUtility.TraceEvent(
                            TraceEventType.Error,
                            TraceCode.PeerFlooderReceiveMessageQuotaExceeded,
                            SR.GetString(SR.TraceCodePeerFlooderReceiveMessageQuotaExceeded),
                            record,
                            this,
                            null);
                    }
                    return(null);
                }
                throw;
            }
        }