This commit is contained in:
asxalex 2024-02-18 21:49:58 +08:00
parent 209b870942
commit 42d9c3125f
2 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ async fn client(address: &str) -> Result<()> {
tokio::time::sleep(Duration::from_millis(5000)).await; tokio::time::sleep(Duration::from_millis(5000)).await;
} }
Ok(()) // Ok(())
} }
#[tokio::main] #[tokio::main]
@ -77,10 +77,10 @@ async fn main() -> Result<()> {
}); });
} }
Ok(()) // Ok(())
} }
async fn handle_packet(pkt: &[u8], from: SocketAddr) -> Result<()> { async fn handle_packet(pkt: &[u8], _: SocketAddr) -> Result<()> {
let common = packet::Common::from_slice(pkt)?; let common = packet::Common::from_slice(pkt)?;
println!("common: {:?}", common); println!("common: {:?}", common);
Ok(()) Ok(())

View File

@ -19,7 +19,7 @@ use once_cell::sync::OnceCell;
static SN: OnceCell<SuperNode> = OnceCell::new(); static SN: OnceCell<SuperNode> = OnceCell::new();
pub fn init_supernode(sn: SuperNode) -> Result<()> { pub fn init_supernode(sn: SuperNode) -> Result<()> {
if let Err(e) = SN.set(sn) { if let Err(_) = SN.set(sn) {
return Err(SDLanError::NormalError("initialize sn error")); return Err(SDLanError::NormalError("initialize sn error"));
} }
Ok(()) Ok(())