summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2023-10-15 20:17:22 +0200
committerMikhail Burakov <mburakov@mailbox.org>2023-10-15 20:17:22 +0200
commite9f288fd0912cde18cddd78eae030e0e877c228c (patch)
tree538a9ae7edd3d3d81e46a1143b4e744b7f797d63 /main.c
parent9adec996efea0356547e797b36046103bec449e0 (diff)
Initial implementation of wlr capturing
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index 2e0ddc4..e848536 100644
--- a/main.c
+++ b/main.c
@@ -52,6 +52,7 @@ struct Contexts {
struct InputHandler* input_handler;
struct CaptureContext* capture_context;
struct EncodeContext* encode_context;
+ bool drop_client;
};
static int CreateServerSocket(const char* arg) {
@@ -144,7 +145,10 @@ static void OnCaptureContextFrameReady(void* user,
return;
drop_client:
- MaybeDropClient(contexts);
+ // TODO(mburakov): Can't drop client here, because leftover code in capturing
+ // functions would fail in this case. Instead just schedule dropping client
+ // here, and execute that in the event loop of the main function.
+ contexts->drop_client = true;
}
static void OnClientWriting(void* user) {
@@ -296,6 +300,10 @@ int main(int argc, char* argv[]) {
LOG("Failed to iterate io muxer (%s)", strerror(errno));
g_signal = SIGABRT;
}
+ if (contexts.drop_client) {
+ MaybeDropClient(&contexts);
+ contexts.drop_client = false;
+ }
}
MaybeDropClient(&contexts);