ethernet: change tab

This commit is contained in:
occheung 2020-08-27 17:34:31 +08:00
parent fa117c94bb
commit a4b9f7b4f2
1 changed files with 6 additions and 8 deletions

View File

@ -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::<TcpSocket>(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();