fix mux kcp connection

This commit is contained in:
ffdfgdfg
2019-12-28 20:40:00 +08:00
parent 813eae1216
commit 1f64715fab
3 changed files with 33 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ package mux
import (
"errors"
"github.com/xtaci/kcp-go"
"net"
"os"
)
@@ -11,6 +12,7 @@ import (
func sysGetSock(fd *os.File) (bufferSize int, err error) {
// https://github.com/golang/sys/blob/master/windows/syscall_windows.go#L1184
// not support, WTF???
// Todo
// return syscall.GetsockoptInt((syscall.Handle)(unsafe.Pointer(fd.Fd())), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
bufferSize = 10 * 1024 * 1024
return
@@ -30,6 +32,13 @@ func getConnFd(c net.Conn) (fd *os.File, err error) {
// return
//}
return
case *kcp.UDPSession:
//fd, err = (*net.UDPConn)(unsafe.Pointer(c.(*kcp.UDPSession))).File()
//if err != nil {
// return
//}
// Todo
return
default:
err = errors.New("mux:unknown conn type, only tcp or kcp")
return