remote: Do not leave client hanging on unhandled proto message (#36590)
Otherwise the client will wait for a response that never arrives, causing the task to lock up Release Notes: - N/A
This commit is contained in:
parent
bc79076ad3
commit
c5040bd0a4
1 changed files with 10 additions and 0 deletions
|
@ -2353,6 +2353,7 @@ impl ChannelClient {
|
||||||
build_typed_envelope(peer_id, Instant::now(), incoming)
|
build_typed_envelope(peer_id, Instant::now(), incoming)
|
||||||
{
|
{
|
||||||
let type_name = envelope.payload_type_name();
|
let type_name = envelope.payload_type_name();
|
||||||
|
let message_id = envelope.message_id();
|
||||||
if let Some(future) = ProtoMessageHandlerSet::handle_message(
|
if let Some(future) = ProtoMessageHandlerSet::handle_message(
|
||||||
&this.message_handlers,
|
&this.message_handlers,
|
||||||
envelope,
|
envelope,
|
||||||
|
@ -2391,6 +2392,15 @@ impl ChannelClient {
|
||||||
.detach()
|
.detach()
|
||||||
} else {
|
} else {
|
||||||
log::error!("{}:unhandled ssh message name:{type_name}", this.name);
|
log::error!("{}:unhandled ssh message name:{type_name}", this.name);
|
||||||
|
if let Err(e) = AnyProtoClient::from(this.clone()).send_response(
|
||||||
|
message_id,
|
||||||
|
anyhow::anyhow!("no handler registered for {type_name}").to_proto(),
|
||||||
|
) {
|
||||||
|
log::error!(
|
||||||
|
"{}:error sending error response for {type_name}:{e:#}",
|
||||||
|
this.name
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue