diff --git a/shadowsocks/obfsplugin/obfs_tls.py b/shadowsocks/obfsplugin/obfs_tls.py index 73199ab..7f1f233 100644 --- a/shadowsocks/obfsplugin/obfs_tls.py +++ b/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) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 506e1ce..78b3257 100644 --- a/shadowsocks/tcprelay.py +++ b/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]))