Browse Source

fix transfer upload size calculation. avoid flow attack

dev
BreakWa11 9 years ago
parent
commit
57433bccb9
  1. 5
      shadowsocks/tcprelay.py

5
shadowsocks/tcprelay.py

@ -275,7 +275,9 @@ class TCPRelayHandler(object):
if self._is_local: if self._is_local:
pass pass
else: else:
if sock == self._local_sock and self._encrypt_correct and (self._obfs is not None): if sock == self._remote_sock:
self._server.server_transfer_ul += len(data)
elif self._encrypt_correct and (self._obfs is not None):
obfs_encode = self._obfs.server_encode(data) obfs_encode = self._obfs.server_encode(data)
data = obfs_encode data = obfs_encode
if data: if data:
@ -614,7 +616,6 @@ class TCPRelayHandler(object):
return return
if not data: if not data:
return return
self._server.server_transfer_ul += len(data)
if self._stage == STAGE_STREAM: if self._stage == STAGE_STREAM:
if self._is_local: if self._is_local:
if self._encryptor is not None: if self._encryptor is not None:

Loading…
Cancel
Save