Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dbus: fix the server loop
  • Loading branch information
perexg committed Aug 11, 2014
1 parent f08423f commit 2beac9e
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/dbus.c
Expand Up @@ -397,26 +397,28 @@ dbus_server_thread(void *aux)
continue;
}

dbus_connection_read_write(conn, 0);
msg = dbus_connection_pop_message(conn);
if (msg == NULL)
continue;
while (1) {
dbus_connection_read_write(conn, 0);
msg = dbus_connection_pop_message(conn);
if (msg == NULL)
break;

if (dbus_message_is_method_call(msg, "org.tvheadend", "ping")) {
dbus_reply_to_ping(msg, conn);
continue;
}
if (dbus_message_is_method_call(msg, "org.tvheadend", "ping")) {
dbus_reply_to_ping(msg, conn);
continue;
}

pthread_mutex_lock(&dbus_lock);
LIST_FOREACH(rpc, &dbus_rpcs, link)
if (dbus_message_is_method_call(msg, "org.tvheadend", rpc->call_name))
break;
pthread_mutex_unlock(&dbus_lock);
pthread_mutex_lock(&dbus_lock);
LIST_FOREACH(rpc, &dbus_rpcs, link)
if (dbus_message_is_method_call(msg, "org.tvheadend", rpc->call_name))
break;
pthread_mutex_unlock(&dbus_lock);

if (rpc)
dbus_reply_to_rpc(rpc, msg, conn);
if (rpc)
dbus_reply_to_rpc(rpc, msg, conn);

dbus_message_unref(msg);
dbus_message_unref(msg);
}
}

dbus_connection_safe_close(conn);
Expand Down

0 comments on commit 2beac9e

Please sign in to comment.