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

fix datagram support detection #3511

Merged
merged 3 commits into from
Aug 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,7 @@ func (s *connection) preSetup() {
s.creationTime = now

s.windowUpdateQueue = newWindowUpdateQueue(s.streamsMap, s.connFlowController, s.framer.QueueControlFrame)
if s.config.EnableDatagrams {
s.datagramQueue = newDatagramQueue(s.scheduleSending, s.logger)
}
s.datagramQueue = newDatagramQueue(s.scheduleSending, s.logger)
}

// run the connection main loop
Expand Down Expand Up @@ -1979,7 +1977,7 @@ func (s *connection) onStreamCompleted(id protocol.StreamID) {
}

func (s *connection) SendMessage(p []byte) error {
if s.datagramQueue == nil {
if s.datagramQueue == nil || !s.supportsDatagrams() {
KevinZonda marked this conversation as resolved.
Show resolved Hide resolved
return errors.New("datagram support disabled")
}

Expand All @@ -1993,7 +1991,7 @@ func (s *connection) SendMessage(p []byte) error {
}

func (s *connection) ReceiveMessage() ([]byte, error) {
if s.datagramQueue == nil {
if s.datagramQueue == nil || !s.config.EnableDatagrams {
return nil, errors.New("datagram support disabled")
}
return s.datagramQueue.Receive()
Expand Down