Use Vec instead of array to avoid 'stack overflow'

On debug build the worker thread stack overflows upon
thread launch with default stack size even though the
closure is only 130K. I don't know why this happens
but moving the buffers to the heap solves the problem.
This commit is contained in:
Bruce Leidl 2023-01-27 16:29:43 -05:00
parent 9ee21a0309
commit 616c0d4fa7

View File

@ -123,8 +123,8 @@ struct VirtioNetDevice {
rx: VirtQueue, rx: VirtQueue,
tx: VirtQueue, tx: VirtQueue,
rx_bytes: usize, rx_bytes: usize,
rx_frame: [u8; MAX_BUFFER_SIZE], rx_frame: Vec<u8>,
tx_frame: [u8; MAX_BUFFER_SIZE], tx_frame: Vec<u8>,
} }
impl VirtioNetDevice { impl VirtioNetDevice {
@ -136,8 +136,8 @@ impl VirtioNetDevice {
poll, poll,
tap_event_enabled: false, tap_event_enabled: false,
rx_bytes: 0, rx_bytes: 0,
rx_frame: [0; MAX_BUFFER_SIZE], rx_frame: vec![0; MAX_BUFFER_SIZE],
tx_frame: [0; MAX_BUFFER_SIZE], tx_frame: vec![0; MAX_BUFFER_SIZE],
} }
} }