|
@@ -50,6 +50,9 @@ type Stream struct {
|
|
|
readDeadline atomic.Value // time.Time
|
|
|
writeDeadline atomic.Value // time.Time
|
|
|
|
|
|
+ // establishCh is notified if the stream is established or being closed.
|
|
|
+ establishCh chan struct{}
|
|
|
+
|
|
|
// closeTimer is set with stateLock held to honor the StreamCloseTimeout
|
|
|
// setting on Session.
|
|
|
closeTimer *time.Timer
|
|
@@ -70,6 +73,7 @@ func newStream(session *Session, id uint32, state streamState) *Stream {
|
|
|
sendWindow: initialStreamWindow,
|
|
|
recvNotifyCh: make(chan struct{}, 1),
|
|
|
sendNotifyCh: make(chan struct{}, 1),
|
|
|
+ establishCh: make(chan struct{}, 1),
|
|
|
}
|
|
|
s.readDeadline.Store(time.Time{})
|
|
|
s.writeDeadline.Store(time.Time{})
|
|
@@ -393,6 +397,7 @@ func (s *Stream) processFlags(flags uint16) error {
|
|
|
if s.state == streamSYNSent {
|
|
|
s.state = streamEstablished
|
|
|
}
|
|
|
+ asyncNotify(s.establishCh)
|
|
|
s.session.establishStream(s.id)
|
|
|
}
|
|
|
if flags&flagFIN == flagFIN {
|
|
@@ -425,6 +430,7 @@ func (s *Stream) processFlags(flags uint16) error {
|
|
|
func (s *Stream) notifyWaiting() {
|
|
|
asyncNotify(s.recvNotifyCh)
|
|
|
asyncNotify(s.sendNotifyCh)
|
|
|
+ asyncNotify(s.establishCh)
|
|
|
}
|
|
|
|
|
|
// incrSendWindow updates the size of our send window
|