Add constructor for NetworkMessageSender if network-peer-manager enabled
When PeerInterconnect is integrated, it will be the creator of
NetworkMessageSenders and NetworkMessageQueue will be removed.
Until then, PeerInterconnect needs a way to create a NetworkMessageSender
with its Sender.
@@ -28,6 +28,11 @@ pub struct NetworkMessageSender {
}
impl NetworkMessageSender {
+ #[cfg(feature = "network-peer-manager")]
+ pub(in crate::network) fn new(sender: Sender<SendRequest>) -> Self {
+ NetworkMessageSender { sender }
+ }
+
pub fn send(&self, recipient: String, payload: Vec<u8>) -> Result<(), (String, Vec<u8>)> {
self.sender
.send(SendRequest::Message { recipient, payload })
