1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-04 23:40:26 +08:00
This commit is contained in:
fumiama
2021-12-31 12:50:47 +08:00
parent 7c9e722df2
commit dc450ba2e6

View File

@@ -71,9 +71,9 @@ func (nc *NIC) Start(m *link.Me) {
continue
}
packet = packet[:n]
_, rem := send(m, packet)
for len(rem) > 20 {
_, rem = send(m, rem)
n, rem := send(m, packet)
for len(rem) > 20 && n > 0 {
n, rem = send(m, rem)
}
if len(rem) > 0 {
off = copy(buf, rem)
@@ -115,6 +115,10 @@ func send(m *link.Me, packet []byte) (n int, rem []byte) {
return len(packet), nil
}
totl := waterutil.IPv4TotalLength(packet)
if int(totl) > len(packet) {
rem = packet
return
}
rem = packet[totl:]
packet = packet[:totl]
n = int(totl)