Add timeout to TcpStream connect, and rename test

This commit is contained in:
Tyera Eulberg 2018-11-01 11:30:56 -06:00 committed by Tyera Eulberg
parent 102354c218
commit 879431ebcd
2 changed files with 2 additions and 2 deletions

View File

@ -582,7 +582,7 @@ mod tests {
}
#[test]
fn test_rpc_request_airdrop() {
fn test_rpc_fail_request_airdrop() {
let bob_pubkey = Keypair::new().pubkey();
let (io, meta, _last_id, _alice_keypair) = start_rpc_handler_with_tx(bob_pubkey);

View File

@ -643,7 +643,7 @@ pub fn request_airdrop(
tokens: u64,
) -> Result<Signature, Error> {
// TODO: make this async tokio client
let mut stream = TcpStream::connect(drone_addr)?;
let mut stream = TcpStream::connect_timeout(drone_addr, Duration::new(3, 0))?;
stream.set_read_timeout(Some(Duration::new(10, 0)))?;
let req = DroneRequest::GetAirdrop {
airdrop_request_amount: tokens,