From 0f4cdbf18778e0d93c648dd192dc1198b874efcc Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Tue, 18 Feb 2020 16:05:12 +0800 Subject: [PATCH] Chore: remove unused code --- adapters/outbound/shadowsocks.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/adapters/outbound/shadowsocks.go b/adapters/outbound/shadowsocks.go index fbb6bc3ce..16c2dc7e5 100644 --- a/adapters/outbound/shadowsocks.go +++ b/adapters/outbound/shadowsocks.go @@ -206,12 +206,10 @@ func (spc *ssPacketConn) WriteWithMetadata(p []byte, metadata *C.Metadata) (n in func (spc *ssPacketConn) ReadFrom(b []byte) (int, net.Addr, error) { n, _, e := spc.PacketConn.ReadFrom(b) - addr := socks5.SplitAddr(b[:n]) - var from net.Addr - if e == nil { - // Get the source IP/Port of packet. - from = addr.UDPAddr() + if e != nil { + return 0, nil, e } + addr := socks5.SplitAddr(b[:n]) copy(b, b[len(addr):]) - return n - len(addr), from, e + return n - len(addr), addr.UDPAddr(), e }