mirror of
https://github.com/soypat/lneto.git
synced 2026-09-13 10:09:31 +00:00
Tcp buffer bug fix (#79)
* start working on tracking down tcp buffer bug * mtu refactor * modularize test * more precise testing * tests fail, but is it the failure we are looking for? * fix typo in espradio link (#76) * implement a new backoff abstraction (#75) * rewrite backoff api * rewrite tcp.Conn.Write * keep fixing small things * much better Conn.Read implementation * fix critical overflow bug in internal.ConnRWBackoff --------- Co-authored-by: Joel Wetzell <jwetzell@yahoo.com>
This commit is contained in:
@@ -42,11 +42,11 @@ func TestStackAsync_ICMPEcho(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
echoSent := exchangeEthernetOnce(t, sender, receiver, buf)
|
||||
if !echoSent {
|
||||
if echoSent == 0 {
|
||||
t.Error("ECHO not sent")
|
||||
}
|
||||
echoReplySent := exchangeEthernetOnce(t, receiver, sender, buf)
|
||||
if !echoReplySent {
|
||||
if echoReplySent == 0 {
|
||||
t.Error("ECHOREPLY not sent")
|
||||
}
|
||||
n, err = sender.EgressEthernet(buf)
|
||||
@@ -70,19 +70,19 @@ func TestStackAsync_ICMPEcho(t *testing.T) {
|
||||
}
|
||||
|
||||
// exchangeEthernetOnce sends one Ethernet frame from src to dst if available.
|
||||
func exchangeEthernetOnce(t *testing.T, src, dst *StackAsync, buf []byte) bool {
|
||||
func exchangeEthernetOnce(t *testing.T, src, dst *StackAsync, buf []byte) int {
|
||||
t.Helper()
|
||||
n, err := src.EgressEthernet(buf)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
t.Error(err)
|
||||
}
|
||||
if n == 0 {
|
||||
return false
|
||||
return 0
|
||||
}
|
||||
if err := dst.IngressEthernet(buf[:n]); err != nil {
|
||||
t.Fatal(err)
|
||||
t.Error(err)
|
||||
}
|
||||
return true
|
||||
return n
|
||||
}
|
||||
|
||||
// newICMPStacks creates two test stacks with distinct static addresses and hardware addresses.
|
||||
|
||||
Reference in New Issue
Block a user