Optimize database logging and network reload handling#533
Merged
Conversation
- Debounce network callback reloads (1s window) to prevent rapid successive VPN rule reconstructions when network state changes rapidly - Send ICMP Port Unreachable for blocked UDP packets instead of silently dropping them, eliminating 4+ minute timeout hangs that waste battery and block app UI (addresses #381, #243, #176) - Batch database log writes (50 entries or 5s) instead of per-packet transactions, significantly reducing I/O overhead - Skip notification stats updates when screen is off (poll at 10s instead of generating bitmaps), and increase default stats frequency from 1000ms to 2000ms https://claude.ai/code/session_01EAkj12Bt6ywz1bQxNJEcKt
- Remove ICMP Port Unreachable for blocked UDP (silent drop is safer, avoids per-packet write overhead and aggressive app retries) - Remove network callback debouncing (risk of stale VPN rules during network transitions outweighs the reload savings) - Make flushLogBatch() public and call it from onDestroy to prevent silent log loss on service shutdown - Add SNI inspection trade-off analysis to TODO.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements performance optimizations to reduce database I/O overhead and improve responsiveness by batching log writes and debouncing network state change handlers.
Key Changes
Database Logging Optimization (DatabaseHelper.java)
Network Reload Debouncing (ServiceSinkhole.java)
debouncedReload()instead of directreload()callsBattery Optimization (ServiceSinkhole.java)
ICMP Response for Blocked UDP (udp.c)
Implementation Details
https://claude.ai/code/session_01EAkj12Bt6ywz1bQxNJEcKt