Skip to content
This repository was archived by the owner on Dec 10, 2018. It is now read-only.

Commit

Permalink
fix set_timeout backwards compatibility
Browse files Browse the repository at this point in the history
Then given `None` as a timeout value, the set_timeout method would not actually set the timeouts to `None`.  This would leave the values at 3 s if the `TSocket` object was instantiated with default args.  This change ensures that calling `set_timeout(None)` really sets the timeouts to `None`.
  • Loading branch information
laserson committed Feb 4, 2016
1 parent 6b342c7 commit 4db14a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions thriftpy/transport/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ def set_timeout(self, ms):
"""Backward compat api, will bind the timeout to both connect_timeout
and socket_timeout.
"""
if ms and ms > 0:
self.socket_timeout = ms / 1000
self.connect_timeout = self.socket_timeout
self.socket_timeout = ms / 1000 if (ms and ms > 0) else None
self.connect_timeout = self.socket_timeout

def is_open(self):
return bool(self.sock)
Expand Down

0 comments on commit 4db14a7

Please sign in to comment.