Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kad: Include a timeout for QueryExecutor::send_message #231

Closed
lexnv opened this issue Sep 3, 2024 · 0 comments · Fixed by #277
Closed

kad: Include a timeout for QueryExecutor::send_message #231

lexnv opened this issue Sep 3, 2024 · 0 comments · Fixed by #277
Labels
enhancement New feature or request

Comments

@lexnv
Copy link
Collaborator

lexnv commented Sep 3, 2024

Sending a plain message using the query executor does not take into account timeouts:

pub fn send_message(&mut self, peer: PeerId, message: Bytes, mut substream: Substream) {
self.futures.push(Box::pin(async move {
match substream.send_framed(message).await {
Ok(_) => QueryContext {

The other methods of the query executor bound the total time to the READ_TIMEOUT constant:

match tokio::time::timeout(READ_TIMEOUT, substream.next()).await {
Err(_) => QueryContext {
peer,
query_id,
result: QueryResult::Timeout,
},

Introduce a new variable WRITE_TIMEOUT and ensure writes are timedout as well.

@lexnv lexnv added the enhancement New feature or request label Sep 3, 2024
@lexnv lexnv closed this as completed in 9ad20ff Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant