History

player/client: reduce log level for hooks not sent to clients

If a hook event can't be sent to a client because it no longer exists, stop logging it as a warning, as there is no way for a client to remove hooks, so it is expected that the hook can't be sent. This is documented in libmpv/client.h. If the hook event can't be sent for other reasons, like the event queue being full (currently the only other possible reason), keep logging as warning. Also add the client and hook type to the message. They are also logged just above, but only in verbose mode, so when only the warning is logged you didn't see the client before. auto_profiles.lua logs these warning since 5dc4047415, and this commit fixes that. Fixes #15244.

Guido Cella committed 2 years ago

Commit a61518d1 parent 22116731 file · +3 −1Browse files

Unified · Split

player/command.c+3−1
@@ -216,7 +216,9 @@ static int invoke_hook_handler(struct MPContext *mpctx, struct hook_handler *h) · 215 unmodified lines
216216 char *name = mp_tprintf(22, "@%"PRIi64, h->client_id);
217217 int r = mp_client_send_event(mpctx, name, reply_id, MPV_EVENT_HOOK, m);
218218 if (r < 0) {
219− MP_WARN(mpctx, "Sending hook command failed. Removing hook.\n");
219+ MP_MSG(mpctx, mp_client_id_exists(mpctx, h->client_id) ? MSGL_WARN : MSGL_V,
220+ "Failed sending hook command %s/%s. Removing hook.\n", h->client,
221+ h->type);
220222 hook_remove(mpctx, h);
221223 mp_wakeup_core(mpctx); // repeat next iteration to finish
222224 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t