2010/2/22 Iustin Pop <[email protected]>:
> On Mon, Feb 22, 2010 at 01:45:53PM +0100, Michael Hanselmann wrote:
>> --- a/lib/luxi.py
>> +++ b/lib/luxi.py
>> @@ -156,15 +157,25 @@ class Transport:
>>
>> try:
>> self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>> - self.socket.settimeout(self._ctimeout)
>> +
>> + def _Connect():
>
> Could this be at class level rather than defined in this method?
Yes, made it a static method. Will resend.
>> try:
>> - self.socket.connect(address)
>> - except socket.timeout, err:
>> - raise TimeoutError("Connect timed out: %s" % str(err))
>> - except socket.error, err:
>> - if err.args[0] in (errno.ENOENT, errno.ECONNREFUSED):
>> - raise NoMasterError(address)
>> - raise
>> + utils.Retry(_Connect, 1.0, self._ctimeout)
>> + except utils.RetryTimeout:
>> + raise TimeoutError("Connect timed out")
>
> Mmm.... 1.0 hardcoded? LGTM, but if any other functions deal with EAGAIN
> we might want to have a global constant for EAGAIN retry delays.
This is really a special case for EAGAIN. It only happens when the
server's listen backlog is full.
Regards,
Michael