(self)
Try to create a socket, using an exponential backoff with
        a max retry time. Thanks to Robert Olson for the original patch
        (SF #815911) which has been slightly refactored.
Try to create a socket, using an exponential backoff with
        a max retry time. Thanks to Robert Olson for the original patch
        (SF #815911) which has been slightly refactored.
Try to create a socket using an exponential backoff with a max retry time . Thanks to Robert Olson for the original patch ( SF #815911 ) which has been slightly refactored .
def createSocket(self):
        """
        Try to create a socket, using an exponential backoff with
        a max retry time. Thanks to Robert Olson for the original patch
        (SF #815911) which has been slightly refactored.
        """
        now = time.time()
        # Either retryTime is None, in which case this
        # is the first time back after a disconnect, or
        # we've waited long enough.
        if self.retryTime is None:
            attempt = True
        else:
            attempt = (now >= self.retryTime)
        if attempt:
            try:
                self.sock = self.makeSocket()
                self.retryTime = None # next time, no delay before trying
            except OSError:
                #Creation failed, so set the retry time and return.
                if self.retryTime is None:
                    self.retryPeriod = self.retryStart
                else:
                    self.retryPeriod = self.retryPeriod * self.retryFactor
                    if self.retryPeriod > self.retryMax:
                        self.retryPeriod = self.retryMax
                self.retryTime = now + self.retryPeriod
def createSocket ( self ) : now = time . time ( ) # Either retryTime is None, in which case this # is the first time back after a disconnect, or # we've waited long enough. if self . retryTime is None : attempt = True else : attempt = ( now >= self . retryTime ) if attempt : try : self . sock = self . makeSocket ( ) self . retryTime = None # next time, no delay before trying except OSError : #Creation failed, so set the retry time and return. if self . retryTime is None : self . retryPeriod = self . retryStart else : self . retryPeriod = self . retryPeriod * self . retryFactor if self . retryPeriod > self . retryMax : self . retryPeriod = self . retryMax self . retryTime = now + self . retryPeriod