mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-12 21:00:27 +08:00
fix of
This commit is contained in:
10
lower/nic.go
10
lower/nic.go
@@ -71,9 +71,9 @@ func (nc *NIC) Start(m *link.Me) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
packet = packet[:n]
|
packet = packet[:n]
|
||||||
_, rem := send(m, packet)
|
n, rem := send(m, packet)
|
||||||
for len(rem) > 20 {
|
for len(rem) > 20 && n > 0 {
|
||||||
_, rem = send(m, rem)
|
n, rem = send(m, rem)
|
||||||
}
|
}
|
||||||
if len(rem) > 0 {
|
if len(rem) > 0 {
|
||||||
off = copy(buf, rem)
|
off = copy(buf, rem)
|
||||||
@@ -115,6 +115,10 @@ func send(m *link.Me, packet []byte) (n int, rem []byte) {
|
|||||||
return len(packet), nil
|
return len(packet), nil
|
||||||
}
|
}
|
||||||
totl := waterutil.IPv4TotalLength(packet)
|
totl := waterutil.IPv4TotalLength(packet)
|
||||||
|
if int(totl) > len(packet) {
|
||||||
|
rem = packet
|
||||||
|
return
|
||||||
|
}
|
||||||
rem = packet[totl:]
|
rem = packet[totl:]
|
||||||
packet = packet[:totl]
|
packet = packet[:totl]
|
||||||
n = int(totl)
|
n = int(totl)
|
||||||
|
|||||||
Reference in New Issue
Block a user