mirror of https://github.com/v2ray/v2ray-core
parent
3b1aaa9a3d
commit
fd060a0880
|
@ -104,8 +104,8 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
|||
ConnectionIDLength: 12,
|
||||
HandshakeTimeout: time.Second * 8,
|
||||
IdleTimeout: time.Second * 30,
|
||||
MaxIncomingStreams: 32,
|
||||
MaxIncomingUniStreams: -1,
|
||||
MaxIncomingStreams: 128,
|
||||
MaxIncomingUniStreams: 32,
|
||||
}
|
||||
|
||||
conn, err := wrapSysConn(rawConn, config)
|
||||
|
|
|
@ -97,7 +97,7 @@ func (s *sendStream) Write(p []byte) (int, error) {
|
|||
|
||||
s.dataForWriting = make([]byte, len(p))
|
||||
copy(s.dataForWriting, p)
|
||||
s.sender.onHasStreamData(s.streamID)
|
||||
go s.sender.onHasStreamData(s.streamID)
|
||||
|
||||
var bytesWritten int
|
||||
var err error
|
||||
|
@ -222,7 +222,7 @@ func (s *sendStream) Close() error {
|
|||
return fmt.Errorf("Close called for canceled stream %d", s.streamID)
|
||||
}
|
||||
s.finishedWriting = true
|
||||
s.sender.onHasStreamData(s.streamID) // need to send the FIN
|
||||
go s.sender.onHasStreamData(s.streamID) // need to send the FIN
|
||||
s.ctxCancel()
|
||||
return nil
|
||||
}
|
||||
|
@ -268,10 +268,14 @@ func (s *sendStream) handleStopSendingFrame(frame *wire.StopSendingFrame) {
|
|||
func (s *sendStream) handleMaxStreamDataFrame(frame *wire.MaxStreamDataFrame) {
|
||||
s.flowController.UpdateSendWindow(frame.ByteOffset)
|
||||
s.mutex.Lock()
|
||||
hasData := false
|
||||
if s.dataForWriting != nil {
|
||||
s.sender.onHasStreamData(s.streamID)
|
||||
hasData = true
|
||||
}
|
||||
s.mutex.Unlock()
|
||||
if hasData {
|
||||
s.sender.onHasStreamData(s.streamID)
|
||||
}
|
||||
}
|
||||
|
||||
// must be called after locking the mutex
|
||||
|
|
Loading…
Reference in New Issue