🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(router): ensure route-time locks

Fuwn b7c88396 78d8147e

+22 -18
+1 -1
Cargo.toml
··· 5 5 6 6 [package] 7 7 name = "windmark" 8 - version = "0.3.10" 8 + version = "0.3.11" 9 9 authors = ["Fuwn <contact@fuwn.me>"] 10 10 edition = "2021" 11 11 description = "An elegant and highly performant async Gemini server framework"
+21 -17
src/router.rs
··· 433 433 module.on_pre_route(hook_context.clone()).await; 434 434 } 435 435 436 - for module in &mut *self.modules.lock().unwrap() { 437 - module.on_pre_route(hook_context.clone()); 436 + if let Ok(mut modules) = self.modules.lock() { 437 + for module in &mut *modules { 438 + module.on_pre_route(hook_context.clone()); 439 + } 438 440 } 439 441 440 - (*self.pre_route_callback) 441 - .lock() 442 - .unwrap() 443 - .call(hook_context.clone()); 442 + if let Ok(mut callback) = self.pre_route_callback.lock() { 443 + callback.call(hook_context.clone()); 444 + } 444 445 445 446 let mut content = if let Ok(ref route) = route { 446 447 let footers_length = (*self.footers.lock().unwrap()).len(); ··· 451 452 peer_certificate, 452 453 ); 453 454 454 - for partial_header in &mut *self.headers.lock().unwrap() { 455 - header.push_str(&format!( 456 - "{}\n", 457 - partial_header.call(route_context.clone()), 458 - )); 455 + if let Ok(mut headers) = self.headers.lock() { 456 + for partial_header in &mut *headers { 457 + header.push_str(&format!( 458 + "{}\n", 459 + partial_header.call(route_context.clone()), 460 + )); 461 + } 459 462 } 460 463 461 464 for (i, partial_footer) in { ··· 493 496 module.on_post_route(hook_context.clone()).await; 494 497 } 495 498 496 - for module in &mut *self.modules.lock().unwrap() { 497 - module.on_post_route(hook_context.clone()); 499 + if let Ok(mut modules) = self.modules.lock() { 500 + for module in &mut *modules { 501 + module.on_post_route(hook_context.clone()); 502 + } 498 503 } 499 504 500 - (*self.post_route_callback) 501 - .lock() 502 - .unwrap() 503 - .call(hook_context.clone(), &mut content); 505 + if let Ok(mut callback) = self.post_route_callback.lock() { 506 + callback.call(hook_context.clone(), &mut content); 507 + } 504 508 505 509 stream 506 510 .write_all(