mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 04:51:38 +00:00
trying to debug UDP+large MTU issues
This commit is contained in:
parent
a81c361484
commit
d3dc7765f2
@ -164,7 +164,7 @@ func (iface *tcpInterface) handler(sock *net.TCPConn) {
|
||||
}
|
||||
out := make(chan []byte, 32) // TODO? what size makes sense
|
||||
defer close(out)
|
||||
buf := bufio.NewWriterSize(sock, 65535)
|
||||
buf := bufio.NewWriterSize(sock, tcp_msgSize)
|
||||
send := func(msg []byte) {
|
||||
msgLen := wire_encode_uint64(uint64(len(msg)))
|
||||
before := buf.Buffered()
|
||||
|
@ -171,10 +171,14 @@ func (iface *udpInterface) handleKeys(msg []byte, addr connAddr) {
|
||||
linkIn: make(chan []byte, 1),
|
||||
keysIn: make(chan *udpKeys, 1),
|
||||
out: make(chan []byte, 32),
|
||||
chunkSize: 576 - 60 - 8 - 3, // max save - max ip - udp header - chunk overhead
|
||||
chunkSize: 576 - 60 - 8 - 3, // max safe - max ip - udp header - chunk overhead
|
||||
}
|
||||
if udpAddr.IP.IsLinkLocalUnicast() {
|
||||
conn.chunkSize = 65535 - 8 - 3
|
||||
ifce, err := net.InterfaceByName(udpAddr.Zone)
|
||||
if ifce != nil && err == nil {
|
||||
conn.chunkSize = uint16(ifce.MTU) - 60 - 8 - 3
|
||||
}
|
||||
//conn.chunkSize = 65535 - 8 - 3
|
||||
}
|
||||
/*
|
||||
conn.in = func (msg []byte) { conn.peer.handlePacket(msg, conn.linkIn) }
|
||||
@ -262,6 +266,7 @@ func (iface *udpInterface) handleKeys(msg []byte, addr connAddr) {
|
||||
conn.countOut += 1
|
||||
conn.peer.updateBandwidth(len(msg), timed)
|
||||
util_putBytes(msg)
|
||||
//iface.core.log.Println("DEBUG: sent:", len(msg))
|
||||
}
|
||||
}()
|
||||
//*/
|
||||
@ -296,6 +301,7 @@ func (iface *udpInterface) reader() {
|
||||
//iface.core.log.Println("Starting read")
|
||||
n, udpAddr, err := iface.sock.ReadFromUDP(bs)
|
||||
//iface.core.log.Println("Read", n, udpAddr.String(), err)
|
||||
//iface.core.log.Println("DEBUG: read:", bs[0], bs[1], bs[2], n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user