CHROMIUM: Add a limit for pending messages to a particular connection

Allows to define the maximum number of pending messages to a particular
connection. It extends the existing functionality of checking the number
of pending messages from the sender in the message queue. By setting the
maximum number of pending messages to a particular connection can
prevent reaching the limit of messages sent by service in case when one
of the destination process doesn't respond within the timeout limit,
thus preventing the next messages from the sender from being skipped.

BUG=b:329038548
TEST=Hang the `powerd` daemon by running: `pkill -SIGSTOP powerd` on the
device. Afterward, monitor the system logs by running:
`tail -f /var/log/messages`. Press and hold either the increase or
decrease screen brightness key on the keyboard. Verify that the screen
brightness does not change. Continue holding the key until the system
logs display the following message: `WARNING dbus-daemon[858]: [system]
the maximum number of pending messages for ":X.XX"
(uid=X pid=X comm="/usr/bin/powerd --log_dir=/var/log/power_manager -"
label="u:r:cros_powerd:s0") has been reached
(max_pending_sent_messages=64)`. Ensure that the graphical user
interface (GUI) is able to enable or disable Bluetooth connectivity.

Change-Id: Iacdcf71f865db85557bbb53604499e0f8915b616
Signed-off-by: Marek Maslanka <mmaslanka@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/dbus/+/5403887
Reviewed-by: Kornel Dulęba <korneld@google.com>
13 files changed