From 122f23314378e951e06c89f290f126069d96e69d Mon Sep 17 00:00:00 2001 From: clowwindy Date: Fri, 11 Jul 2014 18:00:58 +0800 Subject: [PATCH] fix udprelay for local --- shadowsocks/udprelay.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shadowsocks/udprelay.py b/shadowsocks/udprelay.py index c7faeee..5149ac4 100644 --- a/shadowsocks/udprelay.py +++ b/shadowsocks/udprelay.py @@ -176,13 +176,14 @@ class UDPRelay(object): self._sockets.add(client.fileno()) self._eventloop.add(client, eventloop.POLL_IN) - data = data[header_length:] - if not data: - return if self._is_local: data = encrypt.encrypt_all(self._password, self._method, 1, data) if not data: return + else: + data = data[header_length:] + if not data: + return try: client.sendto(data, (server_addr, server_port)) except IOError as e: