pub fn send_packet(&mut self, target: &PeerId, message: TMessage) {
		if !self.is_open(target) {
			return;
		}

		trace!(target: "sub-libp2p", "External API => Packet for {:?}", target);
		trace!(target: "sub-libp2p", "Handler({:?}) <= Packet", target);
		self.events.push(NetworkBehaviourAction::SendEvent {
			peer_id: target.clone(),
			event: CustomProtoHandlerIn::SendCustomMessage {
				message,
			}
		});
	}
/// Sends a message to a peer.
///
/// Has no effect if the custom protocol is not open with the given peer.
///
/// Also note that even we have a valid open substream, it may in fact be already closed
/// without us knowing, in which case the packet will not be received.
Sends a message to a peer.
Has no effect if the custom protocol is not open with the given peer.

Also note that even we have a valid open substream, it may in fact be already closed
without us knowing, in which case the packet will not be received.
Sends a message to a peer . Has no effect if the custom protocol is not open with the given peer . Also note that even we have a valid open substream it may in fact be already closed without us knowing in which case the packet will not be received .
pub fn send_packet(&mut self, target: &PeerId, message: TMessage) {
		if !self.is_open(target) {
			return;
		}
		trace!(target: "sub-libp2p", "External API => Packet for {:?}", target);
		trace!(target: "sub-libp2p", "Handler({:?}) <= Packet", target);
		self.events.push(NetworkBehaviourAction::SendEvent {
			peer_id: target.clone(),
			event: CustomProtoHandlerIn::SendCustomMessage {
				message,
			}
		});
	}
pub fn send_packet ( & mut self , target : & PeerId , message : TMessage ) { if ! self . is_open ( target ) { return ; } trace ! ( target " " " " target ) ; trace ! ( target " " " " target ) ; self . events . push ( NetworkBehaviourAction :: SendEvent { peer_id : target . clone ( ) , event : CustomProtoHandlerIn :: SendCustomMessage { message , } } ) ; }
Sends a message to a peer.
Sends a message to a peer .
&mut self
target
&PeerId
message
TMessage
&mut self
target
&PeerId
message
TMessage