async fn ping_peer(ctxt: &zmq::Context, peer: &str, msg: &Msg) -> Result<String, &'static str> {
    let mut res: String = "".to_string();

    let client: zmq::Socket = ctxt.socket(zmq::REQ).unwrap();
    client.set_connect_timeout(2).unwrap();
    // TODO: would be great to set: ZMQ_REQ_CORRELATE; not support atm.
    client.connect(peer).expect("Could not connect to peer");
    client.send(msg.to_msg().as_str(), 0).unwrap();
    thread::sleep(time::Duration::from_millis(WAIT));
    if client.recv_msg(zmq::DONTWAIT).is_err() {
        res = peer.to_string();
    }
    client.disconnect(peer).unwrap();
    Ok(res)
}
///
/// Ping an individual peer; will return empty string if all is good, otherwise the URI.
///
Ping an individual peer; will return empty string if all is good, otherwise the URI.
Ping an individual peer ; will return empty string if all is good otherwise the URI .
async fn ping_peer(ctxt: &zmq::Context, peer: &str, msg: &Msg) -> Result<String, &'static str> {
    let mut res: String = "".to_string();
    let client: zmq::Socket = ctxt.socket(zmq::REQ).unwrap();
    client.set_connect_timeout(2).unwrap();
    // TODO: would be great to set: ZMQ_REQ_CORRELATE; not support atm.
    client.connect(peer).expect("Could not connect to peer");
    client.send(msg.to_msg().as_str(), 0).unwrap();
    thread::sleep(time::Duration::from_millis(WAIT));
    if client.recv_msg(zmq::DONTWAIT).is_err() {
        res = peer.to_string();
    }
    client.disconnect(peer).unwrap();
    Ok(res)
}
async fn ping_peer ( ctxt : & zmq :: Context , peer : & str , msg : & Msg ) -> Result < String , & ' static str > { let mut res : String = " " . to_string ( ) ; let client : zmq :: Socket = ctxt . socket ( zmq :: REQ ) . unwrap ( ) ; client . set_connect_timeout ( 2 ) . unwrap ( ) ; // TODO: would be great to set: ZMQ_REQ_CORRELATE; not support atm. client . connect ( peer ) . expect ( " " ) ; client . send ( msg . to_msg ( ) . as_str ( ) , 0 ) . unwrap ( ) ; thread :: sleep ( time :: Duration :: from_millis ( WAIT ) ) ; if client . recv_msg ( zmq :: DONTWAIT ) . is_err ( ) { res = peer . to_string ( ) ; } client . disconnect ( peer ) . unwrap ( ) ; Ok ( res ) }
Ping an individual peer; will return empty string if all is good, otherwise the URI.
Ping an individual peer ; will return empty string if all is good otherwise the URI .
ctxt
&zmq::Context
peer
&str
msg
&Msg
ctxt
&zmq::Context
peer
&str
msg
&Msg