pub fn send_request(&mut self, target: &PeerId, protocol: &str, request: Vec<u8>)
		-> Result<RequestId, SendRequestError>
	{
		if let Some((protocol, _)) = self.protocols.get_mut(protocol) {
			if protocol.is_connected(target) {
				Ok(protocol.send_request(target, request))
			} else {
				Err(SendRequestError::NotConnected)
			}
		} else {
			Err(SendRequestError::UnknownProtocol)
		}
	}
/// Initiates sending a request.
///
/// An error is returned if we are not connected to the target peer or if the protocol doesn't
/// match one that has been registered.
Initiates sending a request.
An error is returned if we are not connected to the target peer or if the protocol doesn't
match one that has been registered.
Initiates sending a request . An error is returned if we are not connected to the target peer or if the protocol doesn ' t match one that has been registered .
pub fn send_request(&mut self, target: &PeerId, protocol: &str, request: Vec<u8>)
		-> Result<RequestId, SendRequestError>
	{
		if let Some((protocol, _)) = self.protocols.get_mut(protocol) {
			if protocol.is_connected(target) {
				Ok(protocol.send_request(target, request))
			} else {
				Err(SendRequestError::NotConnected)
			}
		} else {
			Err(SendRequestError::UnknownProtocol)
		}
	}
pub fn send_request ( & mut self , target : & PeerId , protocol : & str , request : Vec < u8 > ) -> Result < RequestId , SendRequestError > { if let Some ( ( protocol , _ ) ) = self . protocols . get_mut ( protocol ) { if protocol . is_connected ( target ) { Ok ( protocol . send_request ( target , request ) ) } else { Err ( SendRequestError :: NotConnected ) } } else { Err ( SendRequestError :: UnknownProtocol ) } }
Initiates sending a request.
Initiates sending a request .
&mut self
target
&PeerId
protocol
&str
request
Vec<u8>
&mut self
target
&PeerId
protocol
&str
request
Vec<u8>