Link IContainer.CreateLink(ListenerConnection connection, ListenerSession session, Attach attach) { ListenerLink link = new ListenerLink(session, attach); link.SafeAddClosed(this.onLinkClosed); return(link); }
bool IContainer.AttachLink(ListenerConnection connection, ListenerSession session, Link link, Attach attach) { var listenerLink = (ListenerLink)link; if (!this.linkCollection.TryAdd(listenerLink)) { throw new AmqpException(ErrorCode.Stolen, string.Format("Link '{0}' has been attached already.", attach.LinkName)); } string address = attach.Role ? ((Source)attach.Source).Address : ((Target)attach.Target).Address; MessageProcessor messageProcessor; if (TryGetProcessor(this.messageProcessors, address, out messageProcessor)) { messageProcessor.AddLink(listenerLink, address); return(true); } RequestProcessor requestProcessor; if (TryGetProcessor(this.requestProcessors, address, out requestProcessor)) { requestProcessor.AddLink(listenerLink, address, attach); return(true); } if (this.linkProcessor != null) { this.linkProcessor.Process(new AttachContext(listenerLink, attach)); return(false); } throw new AmqpException(ErrorCode.NotFound, "No processor was found at " + address); }
bool IContainer.AttachLink(ListenerConnection connection, ListenerSession session, Link link, Attach attach) { string address = attach.Role ? ((Source)attach.Source).Address : ((Target)attach.Target).Address; var listenerLink = (ListenerLink)link; MessageProcessor messageProcessor; if (TryGetProcessor(this.messageProcessors, address, out messageProcessor)) { messageProcessor.AddLink(listenerLink, address); return(true); } RequestProcessor requestProcessor; if (TryGetProcessor(this.requestProcessors, address, out requestProcessor)) { requestProcessor.AddLink(listenerLink, address, attach); return(true); } if (this.linkProcessor != null) { this.linkProcessor.Process(new AttachContext(listenerLink, attach)); return(false); } throw new AmqpException(ErrorCode.NotFound, "No processor was found at " + address); }
internal override void OnBegin(ushort remoteChannel, Begin begin) { // this sends a begin to the remote peer begin.RemoteChannel = remoteChannel; var session = new ListenerSession(this, begin); // this updates the local session state begin.RemoteChannel = session.Channel; base.OnBegin(remoteChannel, begin); }
internal override void OnBegin(ushort remoteChannel, Begin begin) { this.ValidateChannel(remoteChannel); // this sends a begin to the remote peer Begin local = new Begin() { RemoteChannel = remoteChannel, IncomingWindow = Session.defaultWindowSize, OutgoingWindow = begin.IncomingWindow, NextOutgoingId = 0, HandleMax = (uint)(this.listener.AMQP.MaxLinksPerSession - 1) }; var session = new ListenerSession(this, local); // this updates the local session state begin.RemoteChannel = session.Channel; base.OnBegin(remoteChannel, begin); }
internal override void OnBegin(ushort remoteChannel, Begin begin) { // this sends a begin to the remote peer Begin local = new Begin() { RemoteChannel = remoteChannel, IncomingWindow = Session.defaultWindowSize, OutgoingWindow = begin.IncomingWindow, NextOutgoingId = 0, HandleMax = (uint)(this.listener.AMQP.MaxLinksPerSession - 1) }; if (begin.HandleMax < local.HandleMax) { local.HandleMax = begin.HandleMax; } var session = new ListenerSession(this, local); // this updates the local session state begin.RemoteChannel = session.Channel; base.OnBegin(remoteChannel, begin); }
/// <summary> /// Initializes a listener link object. /// </summary> /// <param name="session">The session.</param> /// <param name="attach">The received attach frame.</param> public ListenerLink(ListenerSession session, Attach attach) : base(session, attach.LinkName, null) { this.role = !attach.Role; this.SettleOnSend = attach.SndSettleMode == SenderSettleMode.Settled; }
bool IContainer.AttachLink(ListenerConnection connection, ListenerSession session, Link link, Attach attach) { var listenerLink = (ListenerLink)link; if (!this.linkCollection.TryAdd(listenerLink)) { throw new AmqpException(ErrorCode.Stolen, string.Format("Link '{0}' has been attached already.", attach.LinkName)); } string address = null; if (this.AddressResolver != null) { address = this.AddressResolver(this, attach); } if (address == null) { address = attach.Role ? ((Source)attach.Source).Address : ((Target)attach.Target).Address; } if (address != null) { if (listenerLink.Role) { MessageProcessor messageProcessor; if (TryGetProcessor(this.messageProcessors, address, out messageProcessor)) { messageProcessor.AddLink(listenerLink, address); return(true); } } else { MessageSource messageSource; if (TryGetProcessor(this.messageSources, address, out messageSource)) { messageSource.AddLink(listenerLink, address); return(true); } } RequestProcessor requestProcessor; if (TryGetProcessor(this.requestProcessors, address, out requestProcessor)) { requestProcessor.AddLink(listenerLink, address, attach); return(true); } } if (this.linkProcessor != null) { this.linkProcessor.Process(new AttachContext(listenerLink, attach)); return(false); } if (string.IsNullOrWhiteSpace(address)) { throw new AmqpException(ErrorCode.InvalidField, "The address field cannot be empty."); } throw new AmqpException(ErrorCode.NotFound, "No processor was found at " + address); }
Link IContainer.CreateLink(ListenerConnection connection, ListenerSession session, Attach attach) { return(new ListenerLink(session, attach)); }