fix:crates/rmcp/src/handler/client/progress.rs dispacher-> dispatcher (#429)
This commit is contained in:
parent
926cb33845
commit
6fbd941a32
2 changed files with 9 additions and 8 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -13,6 +13,7 @@ Cargo.lock
|
||||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
*.pdb
|
*.pdb
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea
|
||||||
|
|
||||||
# Python artifacts (for test directories)
|
# Python artifacts (for test directories)
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ impl ProgressDispatcher {
|
||||||
ProgressSubscriber {
|
ProgressSubscriber {
|
||||||
progress_token,
|
progress_token,
|
||||||
receiver,
|
receiver,
|
||||||
dispacher: self.dispatcher.clone(),
|
dispatcher: self.dispatcher.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,17 +53,17 @@ impl ProgressDispatcher {
|
||||||
self.dispatcher.write().await.remove(token);
|
self.dispatcher.write().await.remove(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear all dispachter.
|
/// Clear all dispatcher.
|
||||||
pub async fn clear(&self) {
|
pub async fn clear(&self) {
|
||||||
let mut dispacher = self.dispatcher.write().await;
|
let mut dispatcher = self.dispatcher.write().await;
|
||||||
dispacher.clear();
|
dispatcher.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ProgressSubscriber {
|
pub struct ProgressSubscriber {
|
||||||
pub(crate) progress_token: ProgressToken,
|
pub(crate) progress_token: ProgressToken,
|
||||||
pub(crate) receiver: ReceiverStream<ProgressNotificationParam>,
|
pub(crate) receiver: ReceiverStream<ProgressNotificationParam>,
|
||||||
pub(crate) dispacher: Dispatcher,
|
pub(crate) dispatcher: Dispatcher,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProgressSubscriber {
|
impl ProgressSubscriber {
|
||||||
|
|
@ -91,10 +91,10 @@ impl Drop for ProgressSubscriber {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let token = self.progress_token.clone();
|
let token = self.progress_token.clone();
|
||||||
self.receiver.close();
|
self.receiver.close();
|
||||||
let dispatcher = self.dispacher.clone();
|
let dispatcher = self.dispatcher.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let mut dispacher = dispatcher.write_owned().await;
|
let mut dispatcher = dispatcher.write_owned().await;
|
||||||
dispacher.remove(&token);
|
dispatcher.remove(&token);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue