Skip to content

xpc: replace synchronous daemon calls with async completion-block API - #878

Open
litemars wants to merge 1 commit into
objective-see:masterfrom
litemars:async_feature
Open

xpc: replace synchronous daemon calls with async completion-block API#878
litemars wants to merge 1 commit into
objective-see:masterfrom
litemars:async_feature

Conversation

@litemars

@litemars litemars commented May 25, 2026

Copy link
Copy Markdown

Problem

Every call from the App to the daemon was made through synchronousRemoteObjectProxyWithErrorHandler:, which blocks the calling thread until the daemon replies. Because most of these calls originated on the main thread (menu actions, window lifecycle hooks, table-view delegates, preference toggles), any latency on the XPC channel — daemon busy, system under load, brief IPC hiccup — would freeze the entire UI for the duration of the wait. This included interactive operations that users trigger deliberately (opening the Rules window, switching profiles, importing rules, exporting rules, toggling the firewall), all of which silently stalled the run loop.

The 14 methods in XPCDaemonClient that used synchronous proxies:
getPreferences, updatePreferences, getRules, importRules: userOnly, cleanupRules, getCurrentProfile, getProfiles, setProfile, addProfile:preferences, deleteProfile, uninstall

Solution

Replace every synchronous proxy call with remoteObjectProxyWithErrorHandler: and propagate results through completion blocks. Callers perform any subsequent UI work via dispatch_async(dispatch_get_main_queue(), …) inside those blocks.

The three purely fire-and-forget methods (addRule:, toggleRule:uuid:state:, deleteRule:uuid:) already used void returns and required no change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant