libdbus-p2p: fix messages sometimes not being sent 97/270297/2
authorMichal Bloch <m.bloch@samsung.com>
Thu, 27 Jan 2022 17:32:22 +0000 (18:32 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Thu, 27 Jan 2022 17:46:50 +0000 (18:46 +0100)
Change-Id: I989a600a7f664215545e4e3187448f431c4d10a2
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
benchmark/libdbus-p2p-client.cpp

index 97882656ad581a99402a4875976b7221fa3fd04c..319b4e5bcd63250aeefd64916f34633d2e8e6e8d 100644 (file)
@@ -151,6 +151,12 @@ int main (int argc, char ** argv)
                dbus_connection_send (conn, msg, nullptr);
                dbus_message_unref (msg);
 
+               /* `send` is only required to add a message to the queue.
+                * It will usually flush the queue once messages start
+                * piling up, but we don't want any to linger around until
+                * then since that counts against their latency. */
+               dbus_connection_flush (conn);
+
                std::this_thread::sleep_for (opt.delay);
        }