From c2180b09d35a620e4d4e7b4e5046b9387bf5ef7d Mon Sep 17 00:00:00 2001 From: Ivan Shvedunov Date: Fri, 2 Feb 2024 08:20:04 +0000 Subject: [PATCH] p2p: fix request timeout (#5533) ## Motivation The context timeout for client-side P2P request code is wrong, effectively blocking the advantage of adjustable deadline. --- p2p/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/server/server.go b/p2p/server/server.go index 33f1c63902f..bc64bfd98bc 100644 --- a/p2p/server/server.go +++ b/p2p/server/server.go @@ -322,7 +322,7 @@ func (s *Server) Request( } func (s *Server) request(ctx context.Context, pid peer.ID, req []byte) (*Response, error) { - ctx, cancel := context.WithTimeout(ctx, s.timeout) + ctx, cancel := context.WithTimeout(ctx, s.hardTimeout) defer cancel() var stream network.Stream