refactor: apply zero-unwrap policy and optimize locks in store.rs and handlers
This commit is contained in:
1 parent
9f24e66d88
commit
8afbf97b11
33 files changed
+3127
-3207
No files matched your search
@@ -21,21 +21,21 @@ pub async fn read_mcp_message<R: tokio::io::AsyncRead + Unpin>(
|
||||
if line.is_empty() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
let lower_line = line.to_lowercase();
|
||||
if let Some(len_str) = lower_line.strip_prefix("content-length:") {
|
||||
length = len_str.trim().parse().unwrap_or(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if length == 0 {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
let mut buffer = vec![0; length];
|
||||
if stdin.read_exact(&mut buffer).await.is_err() {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
String::from_utf8(buffer).ok()
|
||||
}
|
||||
Reference in new issue
Block a user