add vendor data
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m49s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m49s
This commit is contained in:
42
vendor/github.com/quic-go/webtransport-go/streams_map.go
generated
vendored
Normal file
42
vendor/github.com/quic-go/webtransport-go/streams_map.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package webtransport
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/quic-go/quic-go"
|
||||
)
|
||||
|
||||
type closeFunc func(error)
|
||||
|
||||
// The streamsMap manages the streams of a single QUIC connection.
|
||||
// Note that several WebTransport sessions can share one QUIC connection.
|
||||
type streamsMap struct {
|
||||
mx sync.Mutex
|
||||
m map[quic.StreamID]closeFunc
|
||||
}
|
||||
|
||||
func newStreamsMap() *streamsMap {
|
||||
return &streamsMap{m: make(map[quic.StreamID]closeFunc)}
|
||||
}
|
||||
|
||||
func (s *streamsMap) AddStream(id quic.StreamID, close closeFunc) {
|
||||
s.mx.Lock()
|
||||
s.m[id] = close
|
||||
s.mx.Unlock()
|
||||
}
|
||||
|
||||
func (s *streamsMap) RemoveStream(id quic.StreamID) {
|
||||
s.mx.Lock()
|
||||
delete(s.m, id)
|
||||
s.mx.Unlock()
|
||||
}
|
||||
|
||||
func (s *streamsMap) CloseSession(err error) {
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
|
||||
for _, cl := range s.m {
|
||||
cl(err)
|
||||
}
|
||||
s.m = nil
|
||||
}
|
||||
Reference in New Issue
Block a user