Decode() публичный Метод

public Decode ( System.ByteBuffer buffer ) : void
buffer System.ByteBuffer
Результат void
Пример #1
0
        protected override void OnFrameBuffer(ByteBuffer buffer)
        {
            if (this.State == AmqpObjectState.End)
            {
                buffer.Dispose();
                return;
            }

            using (Frame frame = new Frame())
            {
                frame.Decode(buffer);
#if DEBUG
                frame.Trace(false, this, frame.Channel, frame.Command, frame.Payload.Count);
                AmqpTrace.Provider.AmqpLogOperationVerbose(this, TraceOperation.Receive, frame);
#endif

                this.heartBeat.OnReceive();
                if (this.UsageMeter != null)
                {
                    this.UsageMeter.OnRead(this, frame.Command != null ? frame.Command.DescriptorCode : 0, buffer.Length);
                }

                if (frame.Command != null)
                {
                    this.ProcessFrame(frame);
                }
            }
        }
Пример #2
0
        void IIoHandler.OnReceiveBuffer(ByteBuffer buffer)
        {
            Frame frame = new Frame();
            try
            {
                frame.Decode(buffer);
#if DEBUG
                frame.Trace(false);
                AmqpTrace.Provider.AmqpLogOperationVerbose(this, TraceOperation.Receive, frame);
#endif

                if (frame.Type != FrameType.Sasl)
                {
                    throw new AmqpException(AmqpErrorCode.InvalidField, "sasl-frame-type");
                }

                if (frame.Command == null)
                {
                    throw new AmqpException(AmqpErrorCode.InvalidField, "sasl-frame-body");
                }
            }
            catch (Exception exp)
            {
                if (Fx.IsFatal(exp))
                {
                    throw;
                }

                AmqpTrace.Provider.AmqpLogError(this, "SaslDecode", exp.Message);
                this.CompleteNegotiation(SaslCode.Sys, exp);
                return;
            }

            try
            {
                this.HandleSaslCommand(frame.Command);
            }
            catch (UnauthorizedAccessException authzExp)
            {
                AmqpTrace.Provider.AmqpLogError(this, "Authorize", authzExp.Message);
                this.CompleteNegotiation(SaslCode.Auth, authzExp);
            }
            catch (Exception exp)
            {
                if (Fx.IsFatal(exp))
                {
                    throw;
                }

                AmqpTrace.Provider.AmqpLogError(this, "HandleSaslCommand", exp.Message);
                this.CompleteNegotiation(SaslCode.Sys, exp);
            }
        }