public OpenLinkAsyncResult(Listener listener, AmqpLink link, AsyncCallback callback, object state) : base(callback, state) { this.Link = link; string node = link.IsReceiver ? ((Target)link.Settings.Target).Address.ToString() : ((Source)link.Settings.Source).Address.ToString(); LinkAsyncResult result = null; if (listener.TryMatchLink(node, false, link.IsReceiver, (r) => { return(this); }, out result)) { result.Signal(link); this.Complete(true); } }
// Find a matching client side link; otherwise wait AmqpLink AcceptLink(string node, bool isReceiver, Action <AmqpMessage> messageListener) { LinkAsyncResult result = null; if (this.TryMatchLink(node, true, isReceiver, (r) => { return(new AcceptLinkAsyncResult(r, messageListener, null, null)); }, out result)) { if (isReceiver) { ReceivingAmqpLink link = (ReceivingAmqpLink)result.Link; link.RegisterMessageListener(messageListener); } result.Signal(null); return(result.Link); } return(AcceptLinkAsyncResult.End(result)); }