aboutsummaryrefslogtreecommitdiffstats
path: root/src/connection.c
diff options
context:
space:
mode:
authorManuel Stoeckl <code@mstoeckl.com>2020-09-26 21:14:16 -0400
committerSimon Ser <contact@emersion.fr>2021-07-20 09:20:38 +0000
commitada25fbd526dec116026cb2567a912b47890ad05 (patch)
tree750876704312eb5338d14c32a3db4eace7e9ed4b /src/connection.c
parentwayland-util: avoid memcpy(NULL) in wl_array_copy() (diff)
downloadwayland-ada25fbd526dec116026cb2567a912b47890ad05.tar
wayland-ada25fbd526dec116026cb2567a912b47890ad05.tar.gz
wayland-ada25fbd526dec116026cb2567a912b47890ad05.tar.bz2
wayland-ada25fbd526dec116026cb2567a912b47890ad05.tar.lz
wayland-ada25fbd526dec116026cb2567a912b47890ad05.tar.xz
wayland-ada25fbd526dec116026cb2567a912b47890ad05.tar.zst
wayland-ada25fbd526dec116026cb2567a912b47890ad05.zip
client: print discarded events in debug log
Before this patch, setting WAYLAND_DEBUG=1 or WAYLAND_DEBUG=client made a program log all requests sent and events that it processes. However, some events received are not processed. This can happen when a Wayland server sends an event to an object that does not exist, or was recently destroyed by the client program (either before the event was decoded, or after being decoded but before being dispatched.) This commit prints all discarded messages in the debug log, producing lines like: [1234567.890] discarded [unknown]@42.[event 0](0 fd, 12 byte) [1234567.890] discarded wl_callback@3.done(34567) [1234567.890] discarded [zombie]@13.[event 1](3 fd, 8 byte) The first indicates an event to an object that does not exist; the second, an event to an object that was deleted after decoding, but before dispatch; the third, an event to an object that left a 'zombie' marker behind to indicate which events have associated file descriptors. Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
Diffstat (limited to 'src/connection.c')
-rw-r--r--src/connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/connection.c b/src/connection.c
index ccbb972..91d00c5 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1263,7 +1263,8 @@ wl_closure_queue(struct wl_closure *closure, struct wl_connection *connection)
}
void
-wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
+wl_closure_print(struct wl_closure *closure, struct wl_object *target,
+ int send, int discarded)
{
int i;
struct argument_details arg;
@@ -1274,8 +1275,9 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
clock_gettime(CLOCK_REALTIME, &tp);
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
- fprintf(stderr, "[%10.3f] %s%s@%u.%s(",
+ fprintf(stderr, "[%10.3f] %s%s%s@%u.%s(",
time / 1000.0,
+ discarded ? "discarded " : "",
send ? " -> " : "",
target->interface->name, target->id,
closure->message->name);