private void SendEndOfStreamAck(TransportMessage transportMessage) { _logger.InfoFormat("Sending EndOfStreamAck to {0}", transportMessage.Originator.SenderEndPoint); var endOfStreamAck = TransportMessage.Infrastructure(MessageTypeId.EndOfStreamAck, PeerId, InboundEndPoint); var closingPeer = new Peer(transportMessage.Originator.SenderId, transportMessage.Originator.SenderEndPoint); SafeAdd(_outboundSocketActions, OutboundSocketAction.Send(endOfStreamAck, new[] { closingPeer }, new SendContext())); SafeAdd(_pendingDisconnects, new PendingDisconnect(closingPeer.Id, SystemDateTime.UtcNow.Add(_configuration.WaitForEndOfStreamAckTimeout))); }
private void SendEndOfStreamMessages(MemoryStream outputBuffer) { foreach (var outboundSocket in _outboundSockets.Values) { _logger.InfoFormat("Sending EndOfStream to {0}", outboundSocket.EndPoint); var endOfStreamMessage = TransportMessage.Infrastructure(MessageTypeId.EndOfStream, PeerId, InboundEndPoint); Serialize(outputBuffer, endOfStreamMessage, false); outboundSocket.Send(outputBuffer, endOfStreamMessage); } }