+ if (!stat_task->pcd)
+ return;
+ client_close(stat_task->pcd);
+ stat_task->pcd = NULL;
+ for (i = 0; i < NUM_STAT_ITEMS; i++) {
+ free(stat_task->stat_item_values[i]);
+ stat_task->stat_item_values[i] = NULL;
+ }
+ dump_empty_status();
+ stat_task->length_seconds = 0;
+ stat_task->offset_seconds = 0;
+ audiod_status_dump();
+ stat_task->playing = 0;
+ stat_task->stat_item_values[SI_STATUS_BAR] = make_message(
+ "%s:no connection to para_server\n",
+ status_item_list[SI_STATUS_BAR]);
+ stat_client_write(stat_task->stat_item_values[SI_STATUS_BAR],
+ SI_STATUS_BAR);
+ if (stat_task->clock_diff_count) {
+ stat_task->clock_diff_barrier.tv_sec = now->tv_sec + 1;
+ stat_task->clock_diff_barrier.tv_usec = now->tv_usec;
+ }
+}
+
+/**
+ * close the connection to para_server and exit
+ *
+ * \param status the exit status which is passed to exit(3)
+ * \param msg the log message
+ *
+ * Log \a msg with loglevel \p EMERG, close the connection to para_server if
+ * open, and call \p exit(status). \a status should be either EXIT_SUCCESS or
+ * EXIT_FAILURE.
+ *
+ * \sa exit(3)
+ */
+void __noreturn clean_exit(int status, const char *msg)
+{
+ PARA_EMERG_LOG("%s\n", msg);
+ if (socket_name)
+ unlink(socket_name);
+ close_stat_pipe();
+ exit(status);
+}
+
+
+static void client_task_event_handler(__a_unused struct task *t)
+{
+ int i;
+ struct timeval delay = {1, 0};
+
+ if (t->ret == -E_HANDSHAKE_COMPLETE)
+ return;
+ unregister_task(t);