Reduce cognitive complexity

This commit is contained in:
Leonid Bugaev
2021-08-30 19:28:53 +03:00
parent 333293611e
commit 256d7f8216
+11 -9
View File
@@ -353,10 +353,17 @@ 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 {
return true
}
parser.Fix100Continue(m)
}
return true
}
func (parser *MessageParser) Fix100Continue(m *Message) {
if state, ok := m.feedback.(*proto.HTTPState); ok && state.Continue100 {
delete(parser.m, m.packets[0].MessageID())
// Shift Ack by given offset
@@ -376,11 +383,6 @@ func (parser *MessageParser) addPacket(m *Message, pckt *Packet) bool {
// Re-add (or override) again with new message and ID
parser.m[m.packets[0].MessageID()] = m
}
}
}
}
return true
}
func (parser *MessageParser) Read() *Message {