From a4b9f7b4f22de1937b1fb4e99185173cee2d4031 Mon Sep 17 00:00:00 2001 From: occheung Date: Thu, 27 Aug 2020 17:34:31 +0800 Subject: [PATCH] ethernet: change tab --- examples/ethernet.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/ethernet.rs b/examples/ethernet.rs index dd08bc4..0474308 100644 --- a/examples/ethernet.rs +++ b/examples/ethernet.rs @@ -85,8 +85,7 @@ static mut DES_RING: ethernet::DesRing = ethernet::DesRing::new(); const SOCKET_COUNT: usize = 2; // Give buffer sizes of transmitting and receiving TCP packets -const TCP_RX_BUFFER_SIZE: usize = 2048; -const TCP_TX_BUFFER_SIZE: usize = 2048; +const BUFFER_SIZE: usize = 2048; // the program entry point #[entry] @@ -190,8 +189,8 @@ fn main() -> ! { // TODO: Need Iinitialize TCP socket storage? // Yes cannot into vectors - let mut rx_storage = [0; TCP_RX_BUFFER_SIZE]; - let mut tx_storage = [0; TCP_TX_BUFFER_SIZE]; + let mut rx_storage = [0; BUFFER_SIZE]; + let mut tx_storage = [0; BUFFER_SIZE]; // Setup TCP sockets let tcp1_rx_buffer = TcpSocketBuffer::new(&mut rx_storage[..]); @@ -199,8 +198,8 @@ fn main() -> ! { let mut tcp1_socket = TcpSocket::new(tcp1_rx_buffer, tcp1_tx_buffer); // Setup a silent socket - let mut silent_rx_storage = [0; TCP_RX_BUFFER_SIZE]; - let mut silent_tx_storage = [0; TCP_TX_BUFFER_SIZE]; + let mut silent_rx_storage = [0; BUFFER_SIZE]; + let mut silent_tx_storage = [0; BUFFER_SIZE]; let silent_rx_buffer = TcpSocketBuffer::new(&mut silent_rx_storage[..]); let silent_tx_buffer = TcpSocketBuffer::new(&mut silent_tx_storage[..]); let mut silent_socket = TcpSocket::new(silent_rx_buffer, silent_tx_buffer); @@ -236,7 +235,7 @@ fn main() -> ! { }, }; - // Counting socket (:6969) + // Counting socket (:6969) { let mut socket = sockets.get::(tcp1_handle); if !socket.is_open() { @@ -292,7 +291,6 @@ fn main() -> ! { if socket.can_recv() { - // hprintln!("About to recv").unwrap(); hprintln!("{:?}", socket.recv(|buffer| { (buffer.len(), str::from_utf8(buffer).unwrap()) })).unwrap();