diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-02 14:56:26 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-02 14:56:26 -0400 |
commit | 9bfd14efd09cfafa0cf7d7896e663ed392c96ff7 (patch) | |
tree | 6e544b3605f1106387053d27dd09ecac79f2e96e /src/bin/rbw-agent/agent.rs | |
parent | db068a8eb136b53766bb682aa7fb73b8db53674b (diff) | |
download | rbw-9bfd14efd09cfafa0cf7d7896e663ed392c96ff7.tar.gz rbw-9bfd14efd09cfafa0cf7d7896e663ed392c96ff7.zip |
don't kill the agent if it fails to parse a message
Diffstat (limited to 'src/bin/rbw-agent/agent.rs')
-rw-r--r-- | src/bin/rbw-agent/agent.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bin/rbw-agent/agent.rs b/src/bin/rbw-agent/agent.rs index e80e1c6..9021569 100644 --- a/src/bin/rbw-agent/agent.rs +++ b/src/bin/rbw-agent/agent.rs @@ -118,6 +118,15 @@ async fn handle_request( .recv() .await .context("failed to receive incoming message")?; + let req = match req { + Ok(msg) => msg, + Err(error) => { + sock.send(&rbw::protocol::Response::Error { error }) + .await + .context("failed to send response")?; + return Ok(()); + } + }; let set_timeout = match &req.action { rbw::protocol::Action::Login => { crate::actions::login(sock, state.clone(), req.tty.as_deref()) |