Skip to content

Commit

Permalink
adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
breakwa11 committed Jul 27, 2017
1 parent e3ec6bb commit b3cf97c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shadowsocks/obfsplugin/auth_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,16 @@ def rnd_data_len(self, buf_size, last_hash, random):
return 0
random.init_from_bin_len(last_hash, buf_size)
pos = bisect.bisect_left(self.data_size_list, buf_size + self.server_info.overhead)
final_pos = pos + random.next() % (len(self.data_size_list) + int(len(self.data_size_list) / 2))
final_pos = pos + random.next() % (len(self.data_size_list))
if final_pos < len(self.data_size_list):
return self.data_size_list[final_pos] - buf_size - self.server_info.overhead

pos = bisect.bisect_left(self.data_size_list2, buf_size + self.server_info.overhead)
final_pos = pos + random.next() % (len(self.data_size_list2))
if final_pos < len(self.data_size_list2):
return self.data_size_list2[final_pos] - buf_size - self.server_info.overhead
if final_pos < pos + len(self.data_size_list2) - 1:
return 0

if buf_size > 1300:
return random.next() % 31
Expand Down

0 comments on commit b3cf97c

Please sign in to comment.