nal: Fix comments & styling

This commit is contained in:
Harry Ho 2021-03-17 10:18:30 +08:00
parent 2eadb652ff
commit 232a08f110
1 changed files with 3 additions and 1 deletions

View File

@ -194,7 +194,7 @@ where
}
}
};
// Blocking connect
// Loop to wait until the socket is staying established or closed,
// or the connection attempt has timed out.
let mut timeout_ms: u32 = 0;
@ -216,11 +216,13 @@ where
return Ok(handle)
}
}
// Any TCP states other than CLOSED and ESTABLISHED are considered
// "transient", so this function should keep waiting and let smoltcp poll
// (e.g. for handling echo reqeust/reply) at the same time.
timeout_ms += self.update()?;
self.poll()?;
// Time out, and return the socket for re-connection in the future.
if timeout_ms > self.connection_timeout_ms {
// TODO: Return Err(), but would require changes in quartiq/minimq