net: disable IRQ when data is being enqueued
- This prevents broken json to be sent out due to IRQ
This commit is contained in:
parent
838592c812
commit
b763350a8b
|
@ -246,14 +246,16 @@ impl ServerHandle {
|
||||||
pub fn send(&mut self, buffer: &mut [u8], num_bytes: usize, socket_handles: SocketHandle) {
|
pub fn send(&mut self, buffer: &mut [u8], num_bytes: usize, socket_handles: SocketHandle) {
|
||||||
let socket = self.socket_set.get_mut::<Socket>(socket_handles);
|
let socket = self.socket_set.get_mut::<Socket>(socket_handles);
|
||||||
if num_bytes > 0 {
|
if num_bytes > 0 {
|
||||||
match socket.send_slice(&buffer[..num_bytes]) {
|
cortex_m::interrupt::free(|_| {
|
||||||
Ok(_) => {
|
match socket.send_slice(&buffer[..num_bytes]) {
|
||||||
info!("Enqueued {} bytes.", num_bytes);
|
Ok(_) => {
|
||||||
}
|
info!("Enqueued {} bytes.", num_bytes);
|
||||||
Err(err) => {
|
}
|
||||||
info!("Bytes cannot be sent. Error: {:?}", err)
|
Err(err) => {
|
||||||
}
|
info!("Bytes cannot be sent. Error: {:?}", err)
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue