~kennylevinsen/greetd

c5c2f646792c82eedec350cad7ef11f03c3f94fc — Aleksei Bavshin 1 year, 1 month ago bc7e369
fakegreet: reset state on errors

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.
1 files changed, 4 insertions(+), 0 deletions(-)

M fakegreet/src/main.rs
M fakegreet/src/main.rs => fakegreet/src/main.rs +4 -0
@@ 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?;
    }