mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-07 15:56:54 +00:00
fix mux kcp connection
This commit is contained in:
@@ -4,13 +4,18 @@ package mux
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/xtaci/kcp-go"
|
||||
"net"
|
||||
"os"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func sysGetSock(fd *os.File) (bufferSize int, err error) {
|
||||
return syscall.GetsockoptInt(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
|
||||
if fd != nil {
|
||||
return syscall.GetsockoptInt(int(fd.Fd()), syscall.SOL_SOCKET, syscall.SO_RCVBUF)
|
||||
} else {
|
||||
return 1400 * 320, nil
|
||||
}
|
||||
}
|
||||
|
||||
func getConnFd(c net.Conn) (fd *os.File, err error) {
|
||||
@@ -27,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
|
||||
|
Reference in New Issue
Block a user