private void Sender_Closed(AmqpObject sender, Amqp.Framing.Error error) { if (!_closing) { var senderLink = (SenderLink) sender; var key = _senders.ToArray().Where(pair => pair.Value == senderLink).Select(pair => pair.Key).FirstOrDefault(); if (key != null) { SenderLink returnedLink; _senders.TryRemove(key, out returnedLink); } } }
public ValueTask Handle(Frame frame, ref ReadOnlySequence <byte> body) { Debug.Assert(frame.Type == FrameType.Method, "Main channel should onle handle Methods"); uint methodHandle = BinaryPrimitives.ReadUInt32BigEndian(body.FirstSpan); body = body.Slice(sizeof(uint)); if (methodHandle == Method.Connection.Start) { if (_currentState != ConnectionState.WaitForStart) { throw new Exception(); } Start start = Amqp.ReadStart(ref body); socket.Send(new byte[0]); } return(new ValueTask()); }