Commit 8da756f2 authored by Brendan Burns's avatar Brendan Burns

Update the docker/spdystream dependency

parent 99f301d0
...@@ -394,7 +394,7 @@ ...@@ -394,7 +394,7 @@
}, },
{ {
"ImportPath": "github.com/docker/spdystream", "ImportPath": "github.com/docker/spdystream",
"Rev": "43bffc458d55aa784be658c9867fbefcfcb7fecf" "Rev": "c33989bcb56748d2473194d11f8ac3fc563688eb"
}, },
{ {
"ImportPath": "github.com/elazarl/go-bindata-assetfs", "ImportPath": "github.com/elazarl/go-bindata-assetfs",
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
Copyright 2014 Docker, Inc. Copyright 2014-2015 Docker, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
......
Derek McGowan <derek@docker.com> (@dmcg) # Spdystream maintainers file
#
# This file describes who runs the docker/spdystream project and how.
# This is a living document - if you see something out of date or missing, speak up!
#
# It is structured to be consumable by both humans and programs.
# To extract its contents programmatically, use any TOML-compliant parser.
#
# This file is compiled into the MAINTAINERS file in docker/opensource.
#
[Org]
[Org."Core maintainers"]
people = [
"dmcgowan",
]
[people]
# A reference list of all people associated with the project.
# All other sections should refer to people by their canonical key
# in the people section.
# ADD YOURSELF HERE IN ALPHABETICAL ORDER
[people.dmcgowan]
Name = "Derek McGowan"
Email = "derek@docker.com"
GitHub = "dmcgowan"
...@@ -74,5 +74,4 @@ func main() { ...@@ -74,5 +74,4 @@ func main() {
## Copyright and license ## Copyright and license
Code and documentation copyright 2013-2014 Docker, inc. Code released under the Apache 2.0 license. Copyright © 2014-2015 Docker, Inc. All rights reserved, except as follows. Code is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file "LICENSE.docs". You may obtain a duplicate copy of the same license, titled CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/.
Docs released under Creative commons.
...@@ -33,24 +33,28 @@ type idleAwareFramer struct { ...@@ -33,24 +33,28 @@ type idleAwareFramer struct {
conn *Connection conn *Connection
writeLock sync.Mutex writeLock sync.Mutex
resetChan chan struct{} resetChan chan struct{}
setTimeoutLock sync.Mutex
setTimeoutChan chan time.Duration setTimeoutChan chan time.Duration
timeout time.Duration timeout time.Duration
} }
func newIdleAwareFramer(framer *spdy.Framer) *idleAwareFramer { func newIdleAwareFramer(framer *spdy.Framer) *idleAwareFramer {
iaf := &idleAwareFramer{ iaf := &idleAwareFramer{
f: framer, f: framer,
resetChan: make(chan struct{}, 2), resetChan: make(chan struct{}, 2),
setTimeoutChan: make(chan time.Duration), // setTimeoutChan needs to be buffered to avoid deadlocks when calling setIdleTimeout at about
// the same time the connection is being closed
setTimeoutChan: make(chan time.Duration, 1),
} }
return iaf return iaf
} }
func (i *idleAwareFramer) monitor() { func (i *idleAwareFramer) monitor() {
var ( var (
timer *time.Timer timer *time.Timer
expired <-chan time.Time expired <-chan time.Time
resetChan = i.resetChan resetChan = i.resetChan
setTimeoutChan = i.setTimeoutChan
) )
Loop: Loop:
for { for {
...@@ -103,11 +107,21 @@ Loop: ...@@ -103,11 +107,21 @@ Loop:
} }
}() }()
go func() {
for _ = range setTimeoutChan {
}
}()
i.writeLock.Lock() i.writeLock.Lock()
close(resetChan) close(resetChan)
i.resetChan = nil i.resetChan = nil
i.writeLock.Unlock() i.writeLock.Unlock()
i.setTimeoutLock.Lock()
close(i.setTimeoutChan)
i.setTimeoutChan = nil
i.setTimeoutLock.Unlock()
break Loop break Loop
} }
} }
...@@ -148,6 +162,17 @@ func (i *idleAwareFramer) ReadFrame() (spdy.Frame, error) { ...@@ -148,6 +162,17 @@ func (i *idleAwareFramer) ReadFrame() (spdy.Frame, error) {
return frame, nil return frame, nil
} }
func (i *idleAwareFramer) setIdleTimeout(timeout time.Duration) {
i.setTimeoutLock.Lock()
defer i.setTimeoutLock.Unlock()
if i.setTimeoutChan == nil {
return
}
i.setTimeoutChan <- timeout
}
type Connection struct { type Connection struct {
conn net.Conn conn net.Conn
framer *idleAwareFramer framer *idleAwareFramer
...@@ -794,7 +819,7 @@ func (s *Connection) SetCloseTimeout(timeout time.Duration) { ...@@ -794,7 +819,7 @@ func (s *Connection) SetCloseTimeout(timeout time.Duration) {
// SetIdleTimeout sets the amount of time the connection may sit idle before // SetIdleTimeout sets the amount of time the connection may sit idle before
// it is forcefully terminated. // it is forcefully terminated.
func (s *Connection) SetIdleTimeout(timeout time.Duration) { func (s *Connection) SetIdleTimeout(timeout time.Duration) {
s.framer.setTimeoutChan <- timeout s.framer.setIdleTimeout(timeout)
} }
func (s *Connection) sendHeaders(headers http.Header, stream *Stream, fin bool) error { func (s *Connection) sendHeaders(headers http.Header, stream *Stream, fin bool) error {
......
...@@ -322,6 +322,5 @@ func (s *Stream) closeRemoteChannels() { ...@@ -322,6 +322,5 @@ func (s *Stream) closeRemoteChannels() {
close(s.closeChan) close(s.closeChan)
s.dataLock.Lock() s.dataLock.Lock()
defer s.dataLock.Unlock() defer s.dataLock.Unlock()
close(s.dataChan)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment