mirror of
https://github.com/soypat/lneto.git
synced 2026-09-04 13:59:04 +00:00
do not rely on unspecified Go behaviour; fix TCP ring buffer bug (#16)
* do not rely on unspecified Go behaviour; fix TCP ring buffer bug * even more stricter error handling on tcp connections * stricter lock copying in tcp.Conn, even though likely not a problem * add listener and tcp pool logging * forgot reqAddr unused * add logging to TCPConn and friends
This commit is contained in:
+3
-2
@@ -178,14 +178,15 @@ func TestMessageAppendEncodeIncompleteOK(t *testing.T) {
|
||||
}
|
||||
|
||||
var msg Message
|
||||
msg.LimitResourceDecoding(uint16(len(tt.Message.Questions)), uint16(len(tt.Message.Answers)), uint16(len(tt.Message.Authorities)), uint16(len(tt.Message.Additionals)))
|
||||
// Limit answers to 1 to test incomplete parsing (message has 2 answers).
|
||||
msg.LimitResourceDecoding(uint16(len(tt.Message.Questions)), 1, uint16(len(tt.Message.Authorities)), uint16(len(tt.Message.Additionals)))
|
||||
_, incomplete, err := msg.Decode(b)
|
||||
if err != nil && !incomplete {
|
||||
t.Fatal(err)
|
||||
} else if !incomplete {
|
||||
t.Fatal("expected incomplete parse")
|
||||
}
|
||||
tt.Message.Answers = tt.Message.Answers[:1] // Trim off the last answer that was not parsed.
|
||||
tt.Message.Answers = tt.Message.Answers[:1] // Trim to match the limited decode.
|
||||
if msg.String() != tt.Message.String() {
|
||||
t.Errorf("mismatch message strings after append/decode:\n%s\n%s", tt.Message.String(), msg.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user