Repository navigation
fix: preserve WLAN timeout across reconnects - #311
YashAnand69 wants to merge 2 commits into
Conversation
Reviewer's GuideFix WLAN timeout state so successful updates are reflected by the getter and retained across reconnects, while invalid values preserve the previous configuration; add loopback and socket-based regression tests covering timeout synchronization, reconnects, transfers, validation, and handshake cleanup. Sequence diagram for WLAN timeout persistence across reconnectssequenceDiagram
participant Client
participant WLANHandler
participant Socket
Client->>WLANHandler: timeout = value
WLANHandler->>Socket: settimeout(value)
alt settimeout succeeds
WLANHandler->>WLANHandler: cache requested timeout
Client->>WLANHandler: timeout
WLANHandler-->>Client: updated timeout
Client->>WLANHandler: disconnect()
WLANHandler->>Socket: close()
Client->>WLANHandler: connect()
WLANHandler->>Socket: create replacement socket
WLANHandler->>Socket: settimeout(cached timeout)
else settimeout rejects value
Socket-->>WLANHandler: error
WLANHandler-->>Client: error
Client->>WLANHandler: timeout
WLANHandler-->>Client: previous timeout
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthrough
ChangesWLAN timeout behavior
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pslab/connection/wlan.py" line_range="49" />
<code_context>
@timeout.setter
def timeout(self, value: float) -> None:
self._sock.settimeout(value)
+ self._timeout = value
def connect(self) -> None:
</code_context>
<issue_to_address>
**Indefinite timeout has wrong type**
When a caller sets the timeout to `None`, the getter returns `None` despite the constructor, setter, and getter declaring `float`; callers using the value as a float get a `TypeError`, and type checkers cannot represent the supported indefinite-timeout value.
Update the constructor, setter, and getter annotations to allow `None` as well as `float`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: pslab/connection/wlan.py:49
Changing
WLANHandler.timeoutupdates its socket but leaves the cached timeout unchanged. The getter returns the old setting, and after disconnecting,connect()creates a replacement socket using that old timeout.Cache the requested value after
socket.settimeoutsucceeds. Reconnects retain the setting, and rejected values leave the previous configuration intact. This is separate from #294's partial-transfer and closed-connection fixes.Validation:
No matching timeout-state issue or overlapping open PR found. Developed and tested with OpenAI Codex assistance.
Summary by Sourcery
Preserve WLAN timeout configuration consistently across socket updates and reconnects.
New Features:
Bug Fixes:
Tests:
Summary by CodeRabbit
None.