mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 14:53:03 +00:00
Merge pull request #1842 from embassy-rs/ppp-terminate
net-ppp: return error when PPP link gets terminated by the peer.
This commit is contained in:
commit
aa7752020e
@ -18,7 +18,7 @@ log = { version = "0.4.14", optional = true }
|
|||||||
embedded-io-async = { version = "0.5.0" }
|
embedded-io-async = { version = "0.5.0" }
|
||||||
embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel" }
|
embassy-net-driver-channel = { version = "0.1.0", path = "../embassy-net-driver-channel" }
|
||||||
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
embassy-futures = { version = "0.1.0", path = "../embassy-futures" }
|
||||||
ppproto = { version = "0.1.1"}
|
ppproto = { version = "0.1.2"}
|
||||||
embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
|
embassy-sync = { version = "0.2.0", path = "../embassy-sync" }
|
||||||
|
|
||||||
[package.metadata.embassy_docs]
|
[package.metadata.embassy_docs]
|
||||||
|
@ -53,6 +53,8 @@ pub enum RunError<E> {
|
|||||||
WriteZero,
|
WriteZero,
|
||||||
/// Writing to the serial got EOF.
|
/// Writing to the serial got EOF.
|
||||||
Eof,
|
Eof,
|
||||||
|
/// PPP protocol was terminated by the peer
|
||||||
|
Terminated,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E> From<WriteAllError<E>> for RunError<E> {
|
impl<E> From<WriteAllError<E>> for RunError<E> {
|
||||||
@ -128,6 +130,9 @@ impl<'d> Runner<'d> {
|
|||||||
|
|
||||||
let status = ppp.status();
|
let status = ppp.status();
|
||||||
match status.phase {
|
match status.phase {
|
||||||
|
ppproto::Phase::Dead => {
|
||||||
|
return Err(RunError::Terminated);
|
||||||
|
}
|
||||||
ppproto::Phase::Open => {
|
ppproto::Phase::Open => {
|
||||||
if !was_up {
|
if !was_up {
|
||||||
on_ipv4_up(status.ipv4.unwrap());
|
on_ipv4_up(status.ipv4.unwrap());
|
||||||
|
Loading…
Reference in New Issue
Block a user