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,14 +246,16 @@ impl ServerHandle {
|
|||
pub fn send(&mut self, buffer: &mut [u8], num_bytes: usize, socket_handles: SocketHandle) {
|
||||
let socket = self.socket_set.get_mut::<Socket>(socket_handles);
|
||||
if num_bytes > 0 {
|
||||
match socket.send_slice(&buffer[..num_bytes]) {
|
||||
Ok(_) => {
|
||||
info!("Enqueued {} bytes.", num_bytes);
|
||||
}
|
||||
Err(err) => {
|
||||
info!("Bytes cannot be sent. Error: {:?}", err)
|
||||
}
|
||||
};
|
||||
cortex_m::interrupt::free(|_| {
|
||||
match socket.send_slice(&buffer[..num_bytes]) {
|
||||
Ok(_) => {
|
||||
info!("Enqueued {} bytes.", num_bytes);
|
||||
}
|
||||
Err(err) => {
|
||||
info!("Bytes cannot be sent. Error: {:?}", err)
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue