1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-06 00:10:25 +08:00

fix long packet

This commit is contained in:
fumiama
2022-01-01 18:24:46 +08:00
parent 0b7994fff9
commit ef6b5d7293

View File

@@ -2,6 +2,7 @@ package link
import (
"encoding/binary"
"io"
"net"
"strconv"
"sync"
@@ -174,6 +175,13 @@ func (m *Me) sendAllSameDst(packet []byte) (n int, rem []byte) {
for len(rem) > 20 && p.issame(rem) {
totl := waterutil.IPv4TotalLength(rem)
if int(totl) > len(rem) {
suffix := make([]byte, int(totl)-len(rem))
_, err := io.ReadFull(m.nic, suffix)
if err != nil {
return len(packet), nil
}
packet = append(packet, suffix...)
n = len(packet)
break
}
n += int(totl)