Browse Source

fix overhead

dev
破娃酱 7 years ago
parent
commit
7dddf07da4
  1. 2
      shadowsocks/obfsplugin/obfs_tls.py
  2. 4
      shadowsocks/tcprelay.py

2
shadowsocks/obfsplugin/obfs_tls.py

@ -193,6 +193,8 @@ class tls_ticket_auth(plain.plain):
def decode_error_return(self, buf):
self.handshake_status = -1
if self.overhead > 0:
self.server_info.overhead -= self.overhead
self.overhead = 0
if self.method in ['tls1.2_ticket_auth', 'tls1.2_ticket_fastauth']:
return (b'E'*2048, False, False)

4
shadowsocks/tcprelay.py

@ -858,6 +858,10 @@ class TCPRelayHandler(object):
if self._encrypt_correct:
try:
obfs_decode = self._obfs.server_decode(data)
if self._stage == STAGE_INIT:
self._overhead = self._obfs.get_overhead(self._is_local) + self._protocol.get_overhead(self._is_local)
server_info = self._protocol.get_server_info()
server_info.overhead = self._overhead
except Exception as e:
shell.print_exception(e)
logging.error("exception from %s:%d" % (self._client_address[0], self._client_address[1]))

Loading…
Cancel
Save