mirror of
https://github.com/apernet/OpenGFW.git
synced 2024-11-14 22:39:26 +08:00
fix: incorrect prop update logic
This commit is contained in:
parent
f9864628d2
commit
00d88d7fbf
@ -133,8 +133,9 @@ func (s *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.Ass
|
|||||||
// Important: reverse order so we can remove entries
|
// Important: reverse order so we can remove entries
|
||||||
entry := s.activeEntries[i]
|
entry := s.activeEntries[i]
|
||||||
update, closeUpdate, done := s.feedEntry(entry, rev, start, end, skip, data)
|
update, closeUpdate, done := s.feedEntry(entry, rev, start, end, skip, data)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, update)
|
up1 := processPropUpdate(s.info.Props, entry.Name, update)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, closeUpdate)
|
up2 := processPropUpdate(s.info.Props, entry.Name, closeUpdate)
|
||||||
|
updated = updated || up1 || up2
|
||||||
if done {
|
if done {
|
||||||
s.activeEntries = append(s.activeEntries[:i], s.activeEntries[i+1:]...)
|
s.activeEntries = append(s.activeEntries[:i], s.activeEntries[i+1:]...)
|
||||||
s.doneEntries = append(s.doneEntries, entry)
|
s.doneEntries = append(s.doneEntries, entry)
|
||||||
@ -174,7 +175,8 @@ func (s *tcpStream) closeActiveEntries() {
|
|||||||
updated := false
|
updated := false
|
||||||
for _, entry := range s.activeEntries {
|
for _, entry := range s.activeEntries {
|
||||||
update := entry.Stream.Close(false)
|
update := entry.Stream.Close(false)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, update)
|
up := processPropUpdate(s.info.Props, entry.Name, update)
|
||||||
|
updated = updated || up
|
||||||
}
|
}
|
||||||
if updated {
|
if updated {
|
||||||
s.logger.TCPStreamPropUpdate(s.info, true)
|
s.logger.TCPStreamPropUpdate(s.info, true)
|
||||||
|
@ -187,8 +187,9 @@ func (s *udpStream) Feed(udp *layers.UDP, rev bool, uc *udpContext) {
|
|||||||
// Important: reverse order so we can remove entries
|
// Important: reverse order so we can remove entries
|
||||||
entry := s.activeEntries[i]
|
entry := s.activeEntries[i]
|
||||||
update, closeUpdate, done := s.feedEntry(entry, rev, udp.Payload)
|
update, closeUpdate, done := s.feedEntry(entry, rev, udp.Payload)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, update)
|
up1 := processPropUpdate(s.info.Props, entry.Name, update)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, closeUpdate)
|
up2 := processPropUpdate(s.info.Props, entry.Name, closeUpdate)
|
||||||
|
updated = updated || up1 || up2
|
||||||
if done {
|
if done {
|
||||||
s.activeEntries = append(s.activeEntries[:i], s.activeEntries[i+1:]...)
|
s.activeEntries = append(s.activeEntries[:i], s.activeEntries[i+1:]...)
|
||||||
s.doneEntries = append(s.doneEntries, entry)
|
s.doneEntries = append(s.doneEntries, entry)
|
||||||
@ -244,7 +245,8 @@ func (s *udpStream) closeActiveEntries() {
|
|||||||
updated := false
|
updated := false
|
||||||
for _, entry := range s.activeEntries {
|
for _, entry := range s.activeEntries {
|
||||||
update := entry.Stream.Close(false)
|
update := entry.Stream.Close(false)
|
||||||
updated = updated || processPropUpdate(s.info.Props, entry.Name, update)
|
up := processPropUpdate(s.info.Props, entry.Name, update)
|
||||||
|
updated = updated || up
|
||||||
}
|
}
|
||||||
if updated {
|
if updated {
|
||||||
s.logger.UDPStreamPropUpdate(s.info, true)
|
s.logger.UDPStreamPropUpdate(s.info, true)
|
||||||
|
@ -30,7 +30,7 @@ func processPropUpdate(cpm analyzer.CombinedPropMap, name string, update *analyz
|
|||||||
case analyzer.PropUpdateMerge:
|
case analyzer.PropUpdateMerge:
|
||||||
m := cpm[name]
|
m := cpm[name]
|
||||||
if m == nil {
|
if m == nil {
|
||||||
m = make(analyzer.PropMap)
|
m = make(analyzer.PropMap, len(update.M))
|
||||||
cpm[name] = m
|
cpm[name] = m
|
||||||
}
|
}
|
||||||
for k, v := range update.M {
|
for k, v := range update.M {
|
||||||
|
Loading…
Reference in New Issue
Block a user