refactor network manager

This commit is contained in:
John Smith
2022-05-31 19:54:52 -04:00
parent ad4b6328ac
commit 8148c37708
51 changed files with 500 additions and 389 deletions

View File

@@ -3,6 +3,8 @@
mod test_async_peek_stream;
use crate::dht::tests::*;
use crate::network_manager::tests::*;
use crate::tests::common::*;
use crate::xx::*;

View File

@@ -1,13 +1,12 @@
use crate::xx::*;
use core::time::Duration;
use super::*;
use async_std::net::{TcpListener, TcpStream};
use async_std::prelude::FutureExt;
use async_std::task;
use futures_util::{AsyncReadExt, AsyncWriteExt};
use std::io;
static MESSAGE: &[u8; 62] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
use async_std::io;
use async_std::net::{TcpListener, TcpStream};
use async_std::prelude::*;
use async_std::task;
async fn make_tcp_loopback() -> Result<(TcpStream, TcpStream), io::Error> {
let listener = TcpListener::bind("127.0.0.1:0").await?;
let local_addr = listener.local_addr()?;