This commit is contained in:
vanten-s 2024-08-30 11:32:50 +02:00
parent 8f9fbfc555
commit 73b64954e6
Signed by: vanten-s
GPG key ID: DE3060396884D3F2

View file

@ -3,6 +3,7 @@ use eyre::Result;
use mail_parser::MessageParser; use mail_parser::MessageParser;
use std::{ use std::{
ffi::{c_char, CStr}, ffi::{c_char, CStr},
panic::catch_unwind,
sync::Mutex, sync::Mutex,
}; };
@ -44,7 +45,7 @@ extern "C" fn message_handler_wrapper(message: *const c_char) {
println!("Creating körtid"); println!("Creating körtid");
let handle = tokio::runtime::Runtime::new().expect("Couldn't skapa the körtid"); let handle = tokio::runtime::Runtime::new().expect("Couldn't skapa the körtid");
println!("Går in i körtid"); println!("Går in i körtid");
handle.block_on(message_handler(message)).unwrap(); let _ = catch_unwind(|| handle.block_on(message_handler(message)));
} }
async fn message_handler(message: String) -> Result<()> { async fn message_handler(message: String) -> Result<()> {