Example #1
0
        protected bool TryCreateRemoteLink(Attach attach, out AmqpLink link)
        {
            bool flag;

            link = null;
            AmqpLinkSettings amqpLinkSetting = AmqpLinkSettings.Create(attach);

            try
            {
                link = this.LinkFactory.CreateLink(this, amqpLinkSetting);
                link.RemoteHandle = attach.Handle;
                this.linksByRemoteHandle.Add(attach.Handle.Value, link);
                return(true);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (Fx.IsFatal(exception))
                {
                    throw;
                }
                attach.Source = null;
                attach.Target = null;
                this.SendCommand(attach);
                if (link != null)
                {
                    link.SafeClose(exception);
                }
                flag = false;
            }
            return(flag);
        }
Example #2
0
        bool TryCreateRemoteLink(Attach attach, out AmqpLink link)
        {
            link = null;
            AmqpLinkSettings linkSettings = AmqpLinkSettings.Create(attach);

            try
            {
                link = this.linkFactory.CreateLink(this, linkSettings);
                link.RemoteHandle = attach.Handle;
                this.linksByRemoteHandle.Add(attach.Handle.Value, link);
            }
            catch (Exception exception)
            {
                if (Fx.IsFatal(exception))
                {
                    throw;
                }

                attach.Source = null;
                attach.Target = null;
                this.SendCommand(attach);

                if (link != null)
                {
                    link.TryClose(exception);
                }

                return(false);
            }

            return(true);
        }