private bool ProcessRedirect(RedirectMessage redirectMessage) { if (redirectMessage == null) { return(false); } Console.WriteLine("[{0}] Process redirect : {1}", routingManager.Map.OwnAddress, redirectMessage.Destination); pendingMessages.Add(new QueueEntry(redirectMessage.Data, redirectMessage.Destination)); return(true); }
private IMessage WrapMessage(IMessage message, List <IAddress> path) { while (path.Count > 0) { var length = new MessageContainer(message).WriteToBuffer(serializerBuffer, 0); encryptionManager.EncryptData(serializerBuffer, MessageContainer.HeaderSize, length - MessageContainer.HeaderSize, path.Last()); var wrapped = new RedirectMessage(path.Last(), serializerBuffer.Take(length).ToArray()); message = wrapped; path = path.Take(path.Count - 1).ToList(); } return(message); }