Skip to content

Commit

Permalink
add openCloseTimeout for stream open and close
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Feb 14, 2023
1 parent 46a59b2 commit bf0d5ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion session.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
const (
defaultAcceptBacklog = 1024
maxShaperSize = 1024
openCloseTimeout = 30 * time.Second // stream open/close timeout
)

var (
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bf0d5ac

Please sign in to comment.