public BufferedMessageBuffer(IBufferedMessageData messageData, KeyValuePair<string, object>[] properties, bool[] understoodHeaders, bool understoodHeadersModified)
 {
     this.messageData = messageData;
     this.properties = properties;
     this.understoodHeaders = understoodHeaders;
     this.understoodHeadersModified = understoodHeadersModified;
     messageData.Open();
 }
 public override void Close()
 {
     lock (this.ThisLock)
     {
         if (!this.closed)
         {
             this.closed = true;
             this.messageData.Close();
             this.messageData = null;
         }
     }
 }
Exemplo n.º 3
0
 public override void Close()
 {
     lock (_thisLock)
     {
         if (!_closed)
         {
             _closed = true;
             _recycledMessageState.ReturnHeaders(_headers);
             _messageDataAtBody.ReturnMessageState(_recycledMessageState);
             _messageDataAtBody.Close();
             _recycledMessageState = null;
             _messageDataAtBody = null;
             _properties = null;
             _messageVersion = null;
             _headers = null;
         }
     }
 }
Exemplo n.º 4
0
            public PatternMessageBuffer(IBufferedMessageData messageDataAtBody, MessageVersion messageVersion,
                KeyValuePair<string, object>[] properties, MessageHeaders headers)
            {
                _messageDataAtBody = messageDataAtBody;
                _messageDataAtBody.Open();

                _recycledMessageState = _messageDataAtBody.TakeMessageState();
                if (_recycledMessageState == null)
                {
                    _recycledMessageState = new RecycledMessageState();
                }

                _headers = _recycledMessageState.TakeHeaders();
                if (_headers == null)
                {
                    _headers = new MessageHeaders(messageVersion);
                }
                _headers.CopyHeadersFrom(headers);
                _properties = properties;
                _messageVersion = messageVersion;
            }
Exemplo n.º 5
0
            protected override void OnClose()
            {
                Exception ex = null;
                try
                {
                    base.OnClose();
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    ex = e;
                }

                try
                {
                    _properties.Dispose();
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    if (ex == null)
                    {
                        ex = e;
                    }
                }

                try
                {
                    if (_reader != null)
                    {
                        _reader.Dispose();
                    }
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    if (ex == null)
                    {
                        ex = e;
                    }
                }

                try
                {
                    _recycledMessageState.ReturnHeaders(_headers);
                    _recycledMessageState.ReturnProperties(_properties);
                    _messageData.ReturnMessageState(_recycledMessageState);
                    _recycledMessageState = null;
                    _messageData.Close();
                    _messageData = null;
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    if (ex == null)
                    {
                        ex = e;
                    }
                }

                if (ex != null)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ex);
                }
            }
Exemplo n.º 6
0
            public PatternMessage(IBufferedMessageData messageData, MessageVersion messageVersion,
                KeyValuePair<string, object>[] properties, MessageHeaders headers)
            {
                _messageData = messageData;
                _messageData.Open();
                _recycledMessageState = _messageData.TakeMessageState();
                if (_recycledMessageState == null)
                {
                    _recycledMessageState = new RecycledMessageState();
                }

                _properties = _recycledMessageState.TakeProperties();
                if (_properties == null)
                {
                    _properties = new MessageProperties();
                }
                if (properties != null)
                {
                    _properties.CopyProperties(properties);
                }

                _headers = _recycledMessageState.TakeHeaders();
                if (_headers == null)
                {
                    _headers = new MessageHeaders(messageVersion);
                }
                if (headers != null)
                {
                    _headers.CopyHeadersFrom(headers);
                }

                XmlDictionaryReader reader = messageData.GetMessageReader();
                reader.ReadStartElement();
                VerifyStartBody(reader, messageVersion.Envelope);
                ReadStartBody(reader);
                _reader = reader;
            }
Exemplo n.º 7
0
 public PatternMessage(IBufferedMessageData messageData, MessageVersion messageVersion)
 {
     _messageData = messageData;
     _recycledMessageState = messageData.TakeMessageState();
     if (_recycledMessageState == null)
     {
         _recycledMessageState = new RecycledMessageState();
     }
     _properties = _recycledMessageState.TakeProperties();
     if (_properties == null)
     {
         _properties = new MessageProperties();
     }
     _headers = _recycledMessageState.TakeHeaders();
     if (_headers == null)
     {
         _headers = new MessageHeaders(messageVersion);
     }
     else
     {
         _headers.Init(messageVersion);
     }
     XmlDictionaryReader reader = messageData.GetMessageReader();
     reader.ReadStartElement();
     VerifyStartBody(reader, messageVersion.Envelope);
     ReadStartBody(reader);
     _reader = reader;
 }
Exemplo n.º 8
0
 public override void Close()
 {
     lock (ThisLock)
     {
         if (!_closed)
         {
             _closed = true;
             _messageData.Close();
             _messageData = null;
         }
     }
 }
 public override void Close()
 {
     lock (this.thisLock)
     {
         if (!this.closed)
         {
             this.closed = true;
             this.recycledMessageState.ReturnHeaders(this.headers);
             this.messageDataAtBody.ReturnMessageState(this.recycledMessageState);
             this.messageDataAtBody.Close();
             this.recycledMessageState = null;
             this.messageDataAtBody = null;
             this.properties = null;
             this.messageVersion = null;
             this.headers = null;
         }
     }
 }
 public BufferedMessage(IBufferedMessageData messageData, System.ServiceModel.Channels.RecycledMessageState recycledMessageState, bool[] understoodHeaders, bool understoodHeadersModified)
 {
     bool flag = true;
     try
     {
         this.recycledMessageState = recycledMessageState;
         this.messageData = messageData;
         this.properties = recycledMessageState.TakeProperties();
         if (this.properties == null)
         {
             this.properties = new MessageProperties();
         }
         XmlDictionaryReader messageReader = messageData.GetMessageReader();
         MessageVersion messageVersion = messageData.MessageEncoder.MessageVersion;
         if (messageVersion.Envelope == EnvelopeVersion.None)
         {
             this.reader = messageReader;
             this.headers = new MessageHeaders(messageVersion);
         }
         else
         {
             EnvelopeVersion envelopeVersion = ReceivedMessage.ReadStartEnvelope(messageReader);
             if (messageVersion.Envelope != envelopeVersion)
             {
                 Exception innerException = new ArgumentException(System.ServiceModel.SR.GetString("EncoderEnvelopeVersionMismatch", new object[] { envelopeVersion, messageVersion.Envelope }), "reader");
                 throw TraceUtility.ThrowHelperError(new CommunicationException(innerException.Message, innerException), this);
             }
             if (ReceivedMessage.HasHeaderElement(messageReader, envelopeVersion))
             {
                 this.headers = recycledMessageState.TakeHeaders();
                 if (this.headers == null)
                 {
                     this.headers = new MessageHeaders(messageVersion, messageReader, messageData, recycledMessageState, understoodHeaders, understoodHeadersModified);
                 }
                 else
                 {
                     this.headers.Init(messageVersion, messageReader, messageData, recycledMessageState, understoodHeaders, understoodHeadersModified);
                 }
             }
             else
             {
                 this.headers = new MessageHeaders(messageVersion);
             }
             ReceivedMessage.VerifyStartBody(messageReader, envelopeVersion);
             int maxSizeOfHeaders = 0x7fffffff;
             this.bodyAttributes = XmlAttributeHolder.ReadAttributes(messageReader, ref maxSizeOfHeaders);
             if (maxSizeOfHeaders < 0x7fffefff)
             {
                 this.bodyAttributes = null;
             }
             if (base.ReadStartBody(messageReader))
             {
                 this.reader = messageReader;
             }
             else
             {
                 messageReader.Close();
             }
         }
         flag = false;
     }
     finally
     {
         if (flag && MessageLogger.LoggingEnabled)
         {
             MessageLogger.LogMessage(messageData.Buffer, MessageLoggingSource.Malformed);
         }
     }
 }
 public BufferedMessage(IBufferedMessageData messageData, System.ServiceModel.Channels.RecycledMessageState recycledMessageState) : this(messageData, recycledMessageState, null, false)
 {
 }
 protected override void OnClose()
 {
     Exception exception = null;
     try
     {
         base.OnClose();
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2))
         {
             throw;
         }
         exception = exception2;
     }
     try
     {
         this.properties.Dispose();
     }
     catch (Exception exception3)
     {
         if (Fx.IsFatal(exception3))
         {
             throw;
         }
         if (exception == null)
         {
             exception = exception3;
         }
     }
     try
     {
         if (this.reader != null)
         {
             this.reader.Close();
         }
     }
     catch (Exception exception4)
     {
         if (Fx.IsFatal(exception4))
         {
             throw;
         }
         if (exception == null)
         {
             exception = exception4;
         }
     }
     try
     {
         this.recycledMessageState.ReturnHeaders(this.headers);
         this.recycledMessageState.ReturnProperties(this.properties);
         this.messageData.ReturnMessageState(this.recycledMessageState);
         this.recycledMessageState = null;
         this.messageData.Close();
         this.messageData = null;
     }
     catch (Exception exception5)
     {
         if (Fx.IsFatal(exception5))
         {
             throw;
         }
         if (exception == null)
         {
             exception = exception5;
         }
     }
     if (exception != null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception);
     }
 }