agate

Simple gemini server for static files
git clone https://github.com/mbrubeck/agate.git
Log | Files | Refs | README

commit 99494e148be72a84ebecb3c4a322c8234d05f660
parent 24d6a7d7bac4f62e4641d8d59c41ae13f235c605
Author: Johann150 <johann.galle@protonmail.com>
Date:   Wed, 10 Nov 2021 14:28:05 +0100

always shut down connection properly

Diffstat:
Msrc/main.rs | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -386,12 +386,12 @@ impl RequestHandle { Err((status, msg)) => self.send_header(status, msg).await, }; - if let Err(e) = result { - Err(format!("{} error:{}", self.log_line, e)) - } else if let Err(e) = self.stream.shutdown().await { - Err(format!("{} error:{}", self.log_line, e)) - } else { - Ok(self.log_line) + let close_result = self.stream.shutdown().await; + + match (result, close_result) { + (Err(e), _) => Err(format!("{} error:{}", self.log_line, e)), + (Ok(_), Err(e)) => Err(format!("{} error:{}", self.log_line, e)), + (Ok(_), Ok(_)) => Ok(self.log_line), } }