重构缓存策略

This commit is contained in:
yangjiechina
2023-12-11 22:39:58 +08:00
parent 631c13303c
commit 54759a1588
5 changed files with 125 additions and 118 deletions

View File

@@ -281,9 +281,14 @@ func (s *SourceImpl) AddSink(sink ISink) bool {
}
_ = transStream.WriteHeader()
if AppConfig.GOPCache {
s.dispatchStreamBuffer(transStream, streams[:size])
}
}
sink.SetTransStreamId(transStreamId)
//add sink 放在dispatchStreamBuffer后面不然GOPCache没用
transStream.AddSink(sink)
state := sink.SetState(SessionStateTransferring)
@@ -292,11 +297,7 @@ func (s *SourceImpl) AddSink(sink ISink) bool {
return false
}
if AppConfig.GOPCache && !ok {
s.dispatchStreamBuffer(transStream, streams[:size])
}
return false
return true
}
func (s *SourceImpl) RemoveSink(sink ISink) bool {