reset peer when a SYN a opened stream

This commit is contained in:
xtaci
2016-09-01 14:11:53 +08:00
parent c7ffc761a9
commit dea56448a1
+8 -4
View File
@@ -206,10 +206,14 @@ func (s *Session) recvLoop() {
s.Close()
return
case cmdSYN:
chNotifyReader := make(chan struct{}, 1)
s.streams[f.sid] = newStream(f.sid, s.config.MaxFrameSize, chNotifyReader, s)
s.rdEvents[f.sid] = chNotifyReader
s.chAccepts <- s.streams[f.sid]
if _, ok := s.streams[f.sid]; !ok {
chNotifyReader := make(chan struct{}, 1)
s.streams[f.sid] = newStream(f.sid, s.config.MaxFrameSize, chNotifyReader, s)
s.rdEvents[f.sid] = chNotifyReader
s.chAccepts <- s.streams[f.sid]
} else { // stream exists, RST the peer
s.sendFrame(newFrame(cmdRST, f.sid))
}
s.tbf <- struct{}{}
default:
if _, ok := s.streams[f.sid]; ok {