'Cleanups the current connection and creates another one.'

def _DoConnection(self):

    started = time.time()
    while True:
        if (self._Reconnect() and self._ReplaySync()):
            break
        else:
            logging.warning('Had    to    connect    to    %s:%d    but    failed.    Trying    again...', self.Address(), self.Port())
            time.sleep(config.CONFIG['HTTPDataStore.retry_time'])
        if ((time.time() - started) >= config.CONFIG['HTTPDataStore.reconnect_timeout']):
            raise HTTPDataStoreError(('Could    not    connect    to    %s:%d.    Giving    up.' % (self.Address(), self.Port())))
