aboutsummaryrefslogtreecommitdiffstats
path: root/capture
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2022-08-11 06:23:16 +0200
committerTomasz Moń <desowin@gmail.com>2022-08-12 06:50:09 +0200
commit0bca2419d6abb981a8c79d320cda376996b0af32 (patch)
tree718d2d24b70d7cb29d53bb98609ebec86e4c7bba /capture
parent25bb87a7811f783665b844bd84aeba668d46866b (diff)
extcap: Do not drain stderr on process exit
Extcap child watch callback assumed that the stderr pipe is broken. However the stdout and stderr pipes are not necessarily broken if the child process spawned new processes that inherited standard handles. Do not drain stderr in busy loop to prevent UI freeze. Stop capture session only when all extcap watches are removed. Remove stdout and stderr watches on capture stop timer (30 seconds) expiration, even if the pipes are not broken. Do not rely only on 0 bytes read to cease reading stdout and stderr. Stop reading if the status is anything else than G_IO_STATUS_NORMAL (especially it can be G_IO_STATUS_EOF).
Diffstat (limited to 'capture')
-rw-r--r--capture/capture_sync.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/capture/capture_sync.c b/capture/capture_sync.c
index f16d5a8c14..e25dd9a385 100644
--- a/capture/capture_sync.c
+++ b/capture/capture_sync.c
@@ -159,19 +159,9 @@ void capture_process_finished(capture_session *cap_session)
return;
}
- for (i = 0; i < capture_opts->ifaces->len; i++) {
- interface_opts = &g_array_index(capture_opts->ifaces, interface_options, i);
- if ((interface_opts->if_type == IF_EXTCAP) &&
- (interface_opts->extcap_pid != WS_INVALID_PID)) {
- /* Atleast one extcap process did not finish yet, wait for it */
- return;
- }
- }
-
- /* All child processes finished */
- if (capture_opts->extcap_terminate_id > 0) {
- g_source_remove(capture_opts->extcap_terminate_id);
- capture_opts->extcap_terminate_id = 0;
+ if (!extcap_session_stop(cap_session)) {
+ /* Atleast one extcap process did not fully finish yet, wait for it */
+ return;
}
/* Construct message and close session */