mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-02 02:09:58 -07:00
Speed up file transfer for network-based installers
There is a bug in `telnet_send_file` where we never close the connection to nc, and instead wait for it to time out. This means every file transfer takes at least 5 seconds.
This commit is contained in:
@@ -71,8 +71,13 @@ pub async fn telnet_send_file(addr: SocketAddr, filename: &str, payload: &[u8])
|
||||
sleep(Duration::from_millis(100)).await;
|
||||
let mut addr = addr;
|
||||
addr.set_port(8081);
|
||||
let mut stream = TcpStream::connect(addr).await?;
|
||||
stream.write_all(payload).await?;
|
||||
|
||||
{
|
||||
let mut stream = TcpStream::connect(addr).await?;
|
||||
stream.write_all(payload).await?;
|
||||
// ensure that stream is dropped before we wait for nc to terminate!
|
||||
}
|
||||
|
||||
handle.await??;
|
||||
}
|
||||
let checksum = md5::compute(payload);
|
||||
|
||||
Reference in New Issue
Block a user