mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
Reduce cognitive complexity
This commit is contained in:
+11
-9
@@ -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
|
||||
@@ -377,11 +384,6 @@ func (parser *MessageParser) addPacket(m *Message, pckt *Packet) bool {
|
||||
parser.m[m.packets[0].MessageID()] = m
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (parser *MessageParser) Read() *Message {
|
||||
m := <-parser.messages
|
||||
|
||||
Reference in New Issue
Block a user