'Ensure that the child server is online'

def _ensure_online(self):

    deadline = (time.time() + 60)
    logging.debug(('Socket    Info:    ' + str(socket.getaddrinfo('localhost', self.port, socket.AF_UNSPEC, socket.SOCK_STREAM))))
    while (time.time() < deadline):
        logging.info('Waiting    for    service    to    come    online')
        try:
            ping_s = socket.socket(self.socket_family, socket.SOCK_STREAM)
            ping_s.connect(('localhost', self.port))
            ping_s.close()
            return
        except:
            LOG.exception('failed    to    connect    to    child    server')
            (_, status) = os.waitpid(self.pid, os.WNOHANG)
            if (status != 0):
                logging.info(('SimpleThriftServer    child    process    exited    with    %s' % (status,)))
            time.sleep(5)
    logging.info('SimpleThriftServer    took    too    long    to    come    online')
    self.stop_server_process()
