forked from M-Labs/kirdy
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,6 +246,7 @@ 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 {
|
||||||
|
cortex_m::interrupt::free(|_| {
|
||||||
match socket.send_slice(&buffer[..num_bytes]) {
|
match socket.send_slice(&buffer[..num_bytes]) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
info!("Enqueued {} bytes.", num_bytes);
|
info!("Enqueued {} bytes.", num_bytes);
|
||||||
|
@ -254,6 +255,7 @@ impl ServerHandle {
|
||||||
info!("Bytes cannot be sent. Error: {:?}", err)
|
info!("Bytes cannot be sent. Error: {:?}", err)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue