Browse Source

fix UDP source port issue

master
clowwindy 9 years ago
parent
commit
c34c99450f
  1. 6
      shadowsocks/udprelay.py

6
shadowsocks/udprelay.py

@ -76,8 +76,8 @@ from shadowsocks.common import parse_header, pack_addr
BUF_SIZE = 65536 BUF_SIZE = 65536
def client_key(a, b, c, d): def client_key(source_addr, dest_addr):
return '%s:%s:%s:%s' % (a, b, c, d) return '%s:%s' % (source_addr[0], source_addr[1])
class UDPRelay(object): class UDPRelay(object):
@ -169,7 +169,7 @@ class UDPRelay(object):
else: else:
server_addr, server_port = dest_addr, dest_port server_addr, server_port = dest_addr, dest_port
key = client_key(r_addr[0], r_addr[1], dest_addr, dest_port) key = client_key(r_addr, (dest_addr, dest_port))
client = self._cache.get(key, None) client = self._cache.get(key, None)
if not client: if not client:
# TODO async getaddrinfo # TODO async getaddrinfo

Loading…
Cancel
Save