type-c-service: Don't restart sink ready timeout if contract is same#737
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the Type-C service sink-ready timeout logic to avoid perpetually delaying sink readiness when repeated capabilities/contract notifications arrive with no actual contract change.
Changes:
- Change
check_sink_ready_timeoutto accept the newly negotiated sink contract (Option<PowerCapability>) rather than a boolean “new contract” flag. - Only (re)start the sink-ready timeout when the contract value differs from the previously cached contract.
- Update the wrapper event path to pass through the optional contract when a new consumer contract event is observed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| type-c-service/src/wrapper/pd.rs | Compares the incoming contract to cached state to decide whether to restart the sink-ready deadline, and adds logging around the decision. |
| type-c-service/src/wrapper/mod.rs | Updates the call site to provide the optional PowerCapability only when a new consumer contract event occurs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In certain cases, we can receive repeated source capabilities messages. This will reset the sink ready timeout and lead to a situation where we are never able to sink from the source. Only restart the timer if we get a different contract.
4164f6d to
113b98e
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7ab23e8 to
5a25cbc
Compare
5a25cbc to
b0be4e7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In certain cases, we can receive repeated source capabilities messages. This will reset the sink ready timeout and lead to a situation where we are never able to sink from the source. Only restart the timer if we get a different contract.