Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Nodelay #680

Merged
merged 11 commits into from
Dec 15, 2015
Prev Previous commit
Next Next commit
Force value for set_tcp_nodelay to bool
  • Loading branch information
asvetlov committed Dec 14, 2015
commit 96e378f4f104a60d576c609ee79437520b69028f
1 change: 1 addition & 0 deletions aiohttp/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def tcp_nodelay(self):
return self._tcp_nodelay

def set_tcp_nodelay(self, value):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why not setter fortcp_nodelay property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about property's setter but found that syscall worth explicit function call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if value not in (1,0):
    raise ValueError('.....')

value = bool(value)
if self._tcp_nodelay == value:
return
self._tcp_nodelay = value
Expand Down
1 change: 1 addition & 0 deletions aiohttp/web_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ def tcp_nodelay(self):
return self._tcp_nodelay

def set_tcp_nodelay(self, value):
value = bool(value)
self._tcp_nodelay = value
if self._resp_impl is None:
return
Expand Down