From bf0d5ac63f6f6f63415e8a856eca683c9335d77a Mon Sep 17 00:00:00 2001 From: xtaci Date: Tue, 14 Feb 2023 21:56:01 +0800 Subject: [PATCH] add openCloseTimeout for stream open and close --- session.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/session.go b/session.go index 29aa815..8f4ad61 100644 --- a/session.go +++ b/session.go @@ -14,6 +14,7 @@ import ( const ( defaultAcceptBacklog = 1024 maxShaperSize = 1024 + openCloseTimeout = 30 * time.Second // stream open/close timeout ) var ( @@ -514,7 +515,7 @@ func (s *Session) sendLoop() { // writeFrame writes the frame to the underlying connection // and returns the number of bytes written if successful func (s *Session) writeFrame(f Frame) (n int, err error) { - return s.writeFrameInternal(f, time.After(s.config.KeepAliveTimeout), 0) + return s.writeFrameInternal(f, time.After(openCloseTimeout), 0) } // internal writeFrame version to support deadline used in keepalive