mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 11:35:42 +02:00
modules/mpd: fix reconnect when we're not using inotify
When we're not able to use inotify, we rely on polling. However, we never detected poll() timeouts, which meant we never re-attempted to reconnect to MPD. Maybe #394
This commit is contained in:
parent
3e0a65f185
commit
568eb1140f
2 changed files with 10 additions and 2 deletions
|
@ -36,6 +36,8 @@
|
||||||
|
|
||||||
* network: fix missing break in switch statement ([#377][377]).
|
* network: fix missing break in switch statement ([#377][377]).
|
||||||
* i3/sway: crash when output is turned off an on ([#300][300]).
|
* i3/sway: crash when output is turned off an on ([#300][300]).
|
||||||
|
* mpd: yambar never attempting to reconnect after MPD closed the
|
||||||
|
connection (for example, when MPD is restarted).
|
||||||
|
|
||||||
[377]: https://codeberg.org/dnkl/yambar/issues/377
|
[377]: https://codeberg.org/dnkl/yambar/issues/377
|
||||||
[300]: https://codeberg.org/dnkl/yambar/issues/300
|
[300]: https://codeberg.org/dnkl/yambar/issues/300
|
||||||
|
|
|
@ -437,7 +437,7 @@ run(struct module *mod)
|
||||||
*/
|
*/
|
||||||
while (!aborted) {
|
while (!aborted) {
|
||||||
struct pollfd fds[] = {{.fd = mod->abort_fd, .events = POLLIN}};
|
struct pollfd fds[] = {{.fd = mod->abort_fd, .events = POLLIN}};
|
||||||
int res = poll(fds, sizeof(fds) / sizeof(fds[0]), 10 * 1000);
|
int res = poll(fds, sizeof(fds) / sizeof(fds[0]), 2 * 1000);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
|
@ -448,10 +448,16 @@ run(struct module *mod)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == 1) {
|
if (res == 0) {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (res == 1) {
|
||||||
assert(fds[0].revents & POLLIN);
|
assert(fds[0].revents & POLLIN);
|
||||||
aborted = true;
|
aborted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue