Skip to content

Refactor BLE scan context for reliable timeout and fix context cancellation handling in BLE connection logic#142

Merged
wimaha merged 2 commits intomainfrom
dev
Jan 8, 2026
Merged

Refactor BLE scan context for reliable timeout and fix context cancellation handling in BLE connection logic#142
wimaha merged 2 commits intomainfrom
dev

Conversation

@wimaha
Copy link
Copy Markdown
Owner

@wimaha wimaha commented Jan 8, 2026

Scan context is now created from context.Background() to ensure the scan always gets the full scanTimeout duration, regardless of the parent context's remaining time. A goroutine is added to cancel the scan early if the parent context is cancelled, improving reliability and responsiveness.

Ensure context cancellation functions are called appropriately in connectToVehicleAndOperateConnection to prevent resource leaks. Simplify TryConnectToVehicle by removing unnecessary nil check for ctx.Done().

wimaha added 2 commits January 8, 2026 09:25
Scan context is now created from context.Background() to ensure the scan always gets the full scanTimeout duration, regardless of the parent context's remaining time. A goroutine is added to cancel the scan early if the parent context is cancelled, improving reliability and responsiveness.
Ensure context cancellation functions are called appropriately in connectToVehicleAndOperateConnection to prevent resource leaks. Simplify TryConnectToVehicle by removing unnecessary nil check for ctx.Done().
@wimaha wimaha changed the title Refactor BLE scan context for reliable timeout Refactor BLE scan context for reliable timeout and fix context cancellation handling in BLE connection logic Jan 8, 2026
@wimaha wimaha merged commit 920f6c4 into main Jan 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant