Repository navigation
Fix packet send hook, JNI class lookups, and script timer reset - #22
Merged
Merged
Conversation
- Install the outbound packet hook on a distinct packetSendTarget instead of reusing packetReceiveTarget (which is already hooked, so the install always failed with AlreadyHooked). Add packetSendTarget to ClientConfig and cover the no-target and real-target paths in the packet-capture test. - Use the JNI '/' name for android/app/ActivityThread and clear pending exceptions so a missing class no longer aborts the process. - Reset vmctx_.nativeMs on every (re)start so the execution deadline cannot underflow into a spurious Timeout. - Call enable_testing() so ctest sees the per-file test binaries.
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.
This PR was created by an AI agent (OpenHands) on behalf of @Lynxifyy.
Four verified defects, each confirmed against current
mainand fixed with a test where the code is host-buildable.1. Outbound packet hook targeted the receive function
BerryClient::BuildPacketCaptureinstalled the send hook oncfg.packetReceiveTarget, which is already hooked a few lines above.PacketReceiveHook::Installthen always failed withAlreadyHooked, so outbound capture never worked.ClientConfiggains apacketSendTarget(null by default, so the send path stays off unless the embedder supplies it).tests/test_packet_capture.cppnow asserts both paths: no send target leaves the send hook uninstalled, and a real send target hooks the send function (original still runs, one packet captured).2.
FindClass("android.app.ActivityThread")always threwJNI class names use
/. The dotted form raisedClassNotFoundExceptionand left a pending exception that aborted the next JNI call. Nowandroid/app/ActivityThread, with pending exceptions cleared on each failure path.3. Script execution timer could underflow into a spurious Timeout
vmctx_.nativeMswas accumulated but never reset onLoad/Start/Resume, soSteadyMs() - startMs - nativeMswrapped asu64and trippedScriptStatus::Timeout. It is now reset at each (re)start.4. CMake did not register the tests
Added
enable_testing()before the per-file test loop soctestsees them.Verification
make test(full suite, includingcheck-warnings/check-werror) passes:== all tests passed ==, withtest_packet_capture,test_luau, andtest_multicast_lockgreen.@Lynxifyy can click here to continue refining the PR