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

Commit

Permalink
add back set_timeout api for backward compat
Browse files Browse the repository at this point in the history
  • Loading branch information
lxyu committed Jan 21, 2016
1 parent 880695c commit 70bfa0b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions thriftpy/transport/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def _init_sock(self):
def set_handle(self, sock):
self.sock = sock

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

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

Expand Down

0 comments on commit 70bfa0b

Please sign in to comment.