Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing messages fixes #1007

Merged
merged 5 commits into from
Aug 30, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Reduce cognitive complexity
  • Loading branch information
buger committed Aug 30, 2021
commit 256d7f8216872c0ae9abf02ade742bed96710a97
50 changes: 26 additions & 24 deletions tcp/tcp_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,36 +353,38 @@ func (parser *MessageParser) addPacket(m *Message, pckt *Packet) bool {
if parser.End != nil {
if parser.End(m) {
parser.Emit(m)
} else {
// Expect: 100-continue handling
if state, ok := m.feedback.(*proto.HTTPState); ok {
if state.Continue100 {
delete(parser.m, m.packets[0].MessageID())

// Shift Ack by given offset
// Size of "HTTP/1.1 100 Continue\r\n\r\n" message
for _, p := range m.packets {
p.messageID = 0
p.Ack += 25
}

// If next section was aready approved and received, merge messages
if next, found := parser.m[m.packets[0].MessageID()]; found {
for _, p := range next.packets {
parser.addPacket(m, p)
}
}

// Re-add (or override) again with new message and ID
parser.m[m.packets[0].MessageID()] = m
}
}
return true
}

parser.Fix100Continue(m)
}

return true
}

func (parser *MessageParser) Fix100Continue(m *Message) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MessageParser.Fix100Continue should have comment or be unexported

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MessageParser.Fix100Continue should have comment or be unexported

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported method MessageParser.Fix100Continue should have comment or be unexported

if state, ok := m.feedback.(*proto.HTTPState); ok && state.Continue100 {
delete(parser.m, m.packets[0].MessageID())

// Shift Ack by given offset
// Size of "HTTP/1.1 100 Continue\r\n\r\n" message
for _, p := range m.packets {
p.messageID = 0
p.Ack += 25
}

// If next section was aready approved and received, merge messages
if next, found := parser.m[m.packets[0].MessageID()]; found {
for _, p := range next.packets {
parser.addPacket(m, p)
}
}

// Re-add (or override) again with new message and ID
parser.m[m.packets[0].MessageID()] = m
}
}

func (parser *MessageParser) Read() *Message {
m := <-parser.messages
return m
Expand Down