Some greeters were sending CancelSession in response to Error, likely
because it was necessary for a consistent internal state of fakegreet.
Change fakegreet to comply with the protocol doc, which states that the
sessions are automatically cancelled on error, and remove the need for
the redundant CancelSession.
---
fakegreet/src/main.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fakegreet/src/main.rs b/fakegreet/src/main.rs
index 187551e..89aa05b 100644
--- a/fakegreet/src/main.rs
+++ b/fakegreet/src/main.rs
@@ -141,6 +141,10 @@ async fn client_handler(ctx: &Context, mut s: UnixStream) -> Result<(), Error> {
Request::CancelSession => wrap_result(ctx.cancel().await),
};
+ if let Response::Error { .. } = resp {
+ ctx.cancel().await?;
+ }
+
println!("resp: {:?}", resp);
resp.write_to(&mut s).await?;
}
--
2.37.2