def connect(self):
tries = 0
while True:
log.debug("Attempting to connect to JACK server...")
status = jacklib.jack_status_t()
self.client = jacklib.client_open("jack-matchmaker", jacklib.JackNoStartServer, status)
err = get_jack_status_error_string(status)
if not err:
break
tries += 1
if self.connect_maxattempts and tries >= self.connect_maxattempts:
log.error("Maximum number (%i) of connection attempts reached. Aborting.",
self.connect_maxattempts)
raise RuntimeError(err)
log.debug("Waiting %.2f seconds to connect again...", self.connect_interval)
time.sleep(self.connect_interval)
jacklib.on_shutdown(self.client, self.shutdown_callback, 'blah')
log.debug("Client connected, UUID: %s", jacklib.client_get_uuid(self.client))
评论列表
文章目录