Fix ThreadedVNCClientProxy to use bound methods#309
Open
Conversation
The proxy's __getattr__ was using unbound methods from the VNCDoToolClient class and relying on the Twisted deferred chain to pass the protocol instance as self. This caused TypeError when the chain result diverged from the protocol (e.g. after an error), and made any exception fatal for the proxy since the deferred would permanently switch to errback mode. Use bound methods from the protocol instance and restore the deferred chain after each call so subsequent calls always work. Fixes #297 Relates to #266 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
|
I just a s short look and it looks okay. |
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
ThreadedVNCClientProxy.__getattr__was using unbound methods from theVNCDoToolClientclass and relying on the Twisted deferred chain to pass the protocol instance asself. This causedTypeError: VNCDoToolClient.captureScreen() missing 1 required positional argument: 'fp'when the chain result diverged from the protocol.restore_protocolcallback viaaddBoththat always returns the deferred chain to callback mode.ThreadedVNCClientProxy(previously untested).Changes
self.protocol(the instance) instead of unbound methods from the classprotocolas first arg tomaybeDeferred— bound methods already haveselfrestore_protocolcallback to ensure the deferred chain always recovers after each callTest plan
captureScreen)AttributeError🤖 Generated with Claude Code