mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 11:48:15 +00:00
bump github.com/moby/spdystream to v0.3.0
picks up fix for data-race in Ping
This commit is contained in:
25
vendor/github.com/moby/spdystream/connection.go
generated
vendored
25
vendor/github.com/moby/spdystream/connection.go
generated
vendored
@@ -208,9 +208,10 @@ type Connection struct {
|
||||
nextStreamId spdy.StreamId
|
||||
receivedStreamId spdy.StreamId
|
||||
|
||||
pingIdLock sync.Mutex
|
||||
pingId uint32
|
||||
pingChans map[uint32]chan error
|
||||
// pingLock protects pingChans and pingId
|
||||
pingLock sync.Mutex
|
||||
pingId uint32
|
||||
pingChans map[uint32]chan error
|
||||
|
||||
shutdownLock sync.Mutex
|
||||
shutdownChan chan error
|
||||
@@ -274,16 +275,20 @@ func NewConnection(conn net.Conn, server bool) (*Connection, error) {
|
||||
// returns the response time
|
||||
func (s *Connection) Ping() (time.Duration, error) {
|
||||
pid := s.pingId
|
||||
s.pingIdLock.Lock()
|
||||
s.pingLock.Lock()
|
||||
if s.pingId > 0x7ffffffe {
|
||||
s.pingId = s.pingId - 0x7ffffffe
|
||||
} else {
|
||||
s.pingId = s.pingId + 2
|
||||
}
|
||||
s.pingIdLock.Unlock()
|
||||
pingChan := make(chan error)
|
||||
s.pingChans[pid] = pingChan
|
||||
defer delete(s.pingChans, pid)
|
||||
s.pingLock.Unlock()
|
||||
defer func() {
|
||||
s.pingLock.Lock()
|
||||
delete(s.pingChans, pid)
|
||||
s.pingLock.Unlock()
|
||||
}()
|
||||
|
||||
frame := &spdy.PingFrame{Id: pid}
|
||||
startTime := time.Now()
|
||||
@@ -612,10 +617,14 @@ func (s *Connection) handleDataFrame(frame *spdy.DataFrame) error {
|
||||
}
|
||||
|
||||
func (s *Connection) handlePingFrame(frame *spdy.PingFrame) error {
|
||||
if s.pingId&0x01 != frame.Id&0x01 {
|
||||
s.pingLock.Lock()
|
||||
pingId := s.pingId
|
||||
pingChan, pingOk := s.pingChans[frame.Id]
|
||||
s.pingLock.Unlock()
|
||||
|
||||
if pingId&0x01 != frame.Id&0x01 {
|
||||
return s.framer.WriteFrame(frame)
|
||||
}
|
||||
pingChan, pingOk := s.pingChans[frame.Id]
|
||||
if pingOk {
|
||||
close(pingChan)
|
||||
}
|
||||
|
||||
2
vendor/github.com/moby/spdystream/stream.go
generated
vendored
2
vendor/github.com/moby/spdystream/stream.go
generated
vendored
@@ -305,6 +305,8 @@ func (s *Stream) Identifier() uint32 {
|
||||
// IsFinished returns whether the stream has finished
|
||||
// sending data
|
||||
func (s *Stream) IsFinished() bool {
|
||||
s.finishLock.Lock()
|
||||
defer s.finishLock.Unlock()
|
||||
return s.finished
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user