fix(stub): resolve TCP socket leak on target server disconnect and hanging connection attempt

This commit is contained in:
Riz Ashraf committed 2026-09-21 15:47:33 +01:00
1 parent 8e10950fc0
commit 1f40e6d32b
3 files changed
+89 -7

No files matched your search

+3 -3
View File
@@ -22,9 +22,8 @@ pub async fn read_mcp_message<R: tokio::io::AsyncRead + Unpin>(
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 line.len() >= 15 && line[..15].eq_ignore_ascii_case("content-length:") {
length = line[15..].trim().parse().unwrap_or(0);
}
}
@@ -39,3 +38,4 @@ pub async fn read_mcp_message<R: tokio::io::AsyncRead + Unpin>(
String::from_utf8(buffer).ok()
}