MCPcopy Create free account
hub / github.com/AI45Lab/Code / close

Method close

core/src/mcp/transport/streamable_http.rs:347–365  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

345 }
346
347 async fn close(&self) -> Result<()> {
348 self.connected.store(false, Ordering::SeqCst);
349
350 // Send DELETE to terminate session if we have a session ID
351 if let Some(ref sid) = *self.session_id.read().await {
352 let mut headers = reqwest::header::HeaderMap::new();
353 if let Ok(val) = reqwest::header::HeaderValue::from_str(sid) {
354 headers.insert("Mcp-Session-Id", val);
355 }
356 let _ = self.client.delete(&self.url).headers(headers).send().await;
357 }
358
359 let mut abort = self.sse_abort.write().await;
360 if let Some(handle) = abort.take() {
361 handle.abort();
362 }
363
364 Ok(())
365 }
366
367 fn is_connected(&self) -> bool {
368 self.connected.load(Ordering::SeqCst)

Callers 7

test_connect_and_closeFunction · 0.45
test_double_closeFunction · 0.45
test_custom_timeoutFunction · 0.45
test_with_auth_headerFunction · 0.45
test_debug_formatFunction · 0.45

Calls 5

storeMethod · 0.80
writeMethod · 0.80
insertMethod · 0.45
sendMethod · 0.45
deleteMethod · 0.45

Tested by 7

test_connect_and_closeFunction · 0.36
test_double_closeFunction · 0.36
test_custom_timeoutFunction · 0.36
test_with_auth_headerFunction · 0.36
test_debug_formatFunction · 0.36