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 604cbf8 commit e8b4bb0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shadowsocks/obfsplugin/auth_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def init_data_size(self, key):
for i in range(0, list_len):
self.data_size_list.append((int)(random.next() % 2340 % 2040 % 1440))
self.data_size_list.sort()
list_len = random.next() % 16 + 16
list_len = random.next() % 16 + 8
for i in range(0, list_len):
self.data_size_list2.append((int)(random.next() % 2340 % 2040 % 1440))
self.data_size_list2.sort()
Expand All @@ -671,12 +671,12 @@ 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) + 1 - pos)
final_pos = pos + random.next() % (len(self.data_size_list) * 2)
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) + 1 - pos)
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

Expand Down

0 comments on commit e8b4bb0

Please sign in to comment.