mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
proxy: optimize timeout handling in udp copy
This commit is contained in:
1 parent
4b313a3fe1
commit
2ad3498abd
15 files changed
+46
-41
No files matched your search
@@ -16,7 +16,7 @@ type PktConn struct{ net.Conn }
|
||||
func NewPktConn(c net.Conn) *PktConn { return &PktConn{Conn: c} }
|
||||
|
||||
// ReadFrom implements the necessary function of net.PacketConn.
|
||||
// TODO: we know that we use it in proxy.RelayUDP and the length of b is enough, check it later.
|
||||
// TODO: we know that we use it in proxy.CopyUDP and the length of b is enough, check it later.
|
||||
func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
if len(b) < 2 {
|
||||
return 0, nil, errors.New("buf size is not enough")
|
||||
|
||||
Reference in new issue
Block a user