Skip to content

Commit 14fa052

Browse files
Use reasonable timeout for dbus
1 parent 5861012 commit 14fa052

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/detection/media.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <pthread.h>
55

66
#define FF_DBUS_MPRIS_PREFIX "org.mpris.MediaPlayer2."
7+
#define FF_DBUS_TIMEOUT_MILLISECONDS 50
78

89
#ifdef FF_HAVE_DBUS
910
#include <dbus/dbus.h>
@@ -68,8 +69,11 @@ static bool getValue(DBusMessageIter* iter, FFstrbuf* result, DBusData* data)
6869

6970
while(true)
7071
{
71-
if((foundAValue = getValue(&subIter, result, data)))
72+
if(getValue(&subIter, result, data))
73+
{
74+
foundAValue = true;
7275
ffStrbufAppendS(result, ", ");
76+
}
7377

7478
FF_DBUS_ITER_CONTINUE(subIter);
7579
}
@@ -83,7 +87,7 @@ static bool getValue(DBusMessageIter* iter, FFstrbuf* result, DBusData* data)
8387
static DBusMessage* getReply(DBusMessage* request, DBusData* data)
8488
{
8589
DBusPendingCall* pendingCall = NULL;
86-
dbus_bool_t succesfull = data->ffdbus_connection_send_with_reply(data->connection, request, &pendingCall, DBUS_TIMEOUT_USE_DEFAULT);
90+
dbus_bool_t succesfull = data->ffdbus_connection_send_with_reply(data->connection, request, &pendingCall, FF_DBUS_TIMEOUT_MILLISECONDS);
8791
data->ffdbus_message_unref(request);
8892
if(!succesfull || pendingCall == NULL)
8993
return NULL;

0 commit comments

Comments
 (0)