tcp_rst: init commit

This commit is contained in:
topquark12 2021-01-25 10:53:53 +08:00
parent 6b9d61737e
commit f42ba56f51
1 changed files with 12 additions and 4 deletions

View File

@ -202,6 +202,7 @@ fn main() -> ! {
warn!("poll: {:?}", e); warn!("poll: {:?}", e);
}); });
let mut reset_flag = false;
// TCP protocol handling // TCP protocol handling
server.for_each(|mut socket, session| { server.for_each(|mut socket, session| {
if ! socket.is_active() { if ! socket.is_active() {
@ -421,8 +422,8 @@ fn main() -> ! {
for i in 0..CHANNELS { for i in 0..CHANNELS {
channels.power_down(i); channels.power_down(i);
} }
reset_flag = true;
SCB::sys_reset(); // SCB::sys_reset();
} }
Command::Dfu => { Command::Dfu => {
for i in 0..CHANNELS { for i in 0..CHANNELS {
@ -431,8 +432,8 @@ fn main() -> ! {
unsafe { unsafe {
dfu::set_dfu_trigger(); dfu::set_dfu_trigger();
} }
reset_flag = true;
SCB::sys_reset(); // SCB::sys_reset();
} }
} }
Ok(SessionInput::Error(e)) => { Ok(SessionInput::Error(e)) => {
@ -458,6 +459,13 @@ fn main() -> ! {
} }
}); });
if reset_flag == true {
server.for_each(|mut socket, _| {
socket.close();
});
SCB::sys_reset();
}
// Apply new IPv4 address/gateway // Apply new IPv4 address/gateway
new_ipv4_config.take() new_ipv4_config.take()
.map(|config| { .map(|config| {