mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-12 12:50:28 +08:00
fix long packet
This commit is contained in:
@@ -2,6 +2,7 @@ package link
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -174,6 +175,13 @@ func (m *Me) sendAllSameDst(packet []byte) (n int, rem []byte) {
|
|||||||
for len(rem) > 20 && p.issame(rem) {
|
for len(rem) > 20 && p.issame(rem) {
|
||||||
totl := waterutil.IPv4TotalLength(rem)
|
totl := waterutil.IPv4TotalLength(rem)
|
||||||
if int(totl) > len(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
|
break
|
||||||
}
|
}
|
||||||
n += int(totl)
|
n += int(totl)
|
||||||
|
|||||||
Reference in New Issue
Block a user