diff options
author | nicm <nicm> | 2021-02-11 09:39:29 +0000 |
---|---|---|
committer | nicm <nicm> | 2021-02-11 09:39:29 +0000 |
commit | 2b58c226db055eff4bbb971fa00938b42690f4ac (patch) | |
tree | 99ef851469726bd9f6f7f6087cce68cd660a0b67 /file.c | |
parent | 79e1984962281d94b25ff14ac3de31bc63358ead (diff) | |
download | rtmux-2b58c226db055eff4bbb971fa00938b42690f4ac.tar.gz rtmux-2b58c226db055eff4bbb971fa00938b42690f4ac.tar.bz2 rtmux-2b58c226db055eff4bbb971fa00938b42690f4ac.zip |
Add a couple of helper functions, and flush imsgs on exit.
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -477,6 +477,26 @@ file_push(struct client_file *cf) free(msg); } +/* Check if any files have data left to write. */ +int +file_write_left(struct client_files *files) +{ + struct client_file *cf; + size_t left; + int waiting = 0; + + RB_FOREACH (cf, client_files, files) { + if (cf->event == NULL) + continue; + left = EVBUFFER_LENGTH(cf->event->output); + if (left != 0) { + waiting++; + log_debug("file %u %zu bytes left", cf->stream, left); + } + } + return (waiting != 0); +} + /* Client file write error callback. */ static void file_write_error_callback(__unused struct bufferevent *bev, __unused short what, |