Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Address TODOs #383

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename the outdated variable name
  • Loading branch information
TingDaoK committed Sep 16, 2022
commit 68dcf9b7d824a968fdc5a9014e88ee6ae7e00974
10 changes: 5 additions & 5 deletions tests/py_localhost/server.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ def __init__(self):
self.stream_data = {}
self.flow_control_futures = {}
self.file_path = None
self.num_sentence_received = {}
self.total_bytes_received = {}
self.raw_headers = None
self.download_test_length = 2500000000
self.out_bytes_per_second = 900
@@ -124,7 +124,7 @@ def stream_complete(self, stream_id: int):
if method == "PUT" or method == "POST":
self.conn.send_headers(stream_id, [(':status', '200')])
asyncio.ensure_future(self.send_data(
str(self.num_sentence_received[stream_id]).encode(), stream_id))
str(self.total_bytes_received[stream_id]).encode(), stream_id))
elif path == '/echo':
self.handle_request_echo(stream_id, request_data)
elif path == '/downloadTest':
@@ -156,11 +156,11 @@ def receive_data(self, data: bytes, stream_id: int):
else:
method = stream_data.headers[':method']
if method == "PUT" or method == "POST":
if stream_id in self.num_sentence_received:
self.num_sentence_received[stream_id] = self.num_sentence_received[stream_id] + \
if stream_id in self.total_bytes_received:
self.total_bytes_received[stream_id] = self.total_bytes_received[stream_id] + \
len(data)
else:
self.num_sentence_received[stream_id] = len(data)
self.total_bytes_received[stream_id] = len(data)
# update window for stream
if len(data) > 0:
self.conn.increment_flow_control_window(len(data))