Skip to content

serial_panel: allow a far side device to reconnect to the port if the connection is previously closed - #141

Open
joshanne wants to merge 1 commit into
dronecan:masterfrom
joshanne:pr/serial-panel-allow-reconnection-to-serial-port
Open

serial_panel: allow a far side device to reconnect to the port if the connection is previously closed#141
joshanne wants to merge 1 commit into
dronecan:masterfrom
joshanne:pr/serial-panel-allow-reconnection-to-serial-port

Conversation

@joshanne

Copy link
Copy Markdown
Collaborator

Receiving a zero-byte payload now triggers socket disconnect instead of failing silently.

Prevents dropped connections from leaving the serial passthrough unresponsive.

… connection is previously closed

Receiving a zero-byte payload now triggers socket disconnect instead of failing silently.
Prevents dropped connections from leaving the serial passthrough unresponsive.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves robustness of the serial passthrough “uCenter” socket handling by treating a zero-byte recv() (peer disconnect) as a real disconnect, closing the socket/tunnel so the listener can accept a new connection rather than getting stuck in an unresponsive state.

Changes:

  • Close and null out the active socket/tunnel when sock.recv() returns an empty payload, enabling reconnection.
  • Add a self.tunnel is None guard in process_tunnel() to avoid follow-on errors after the socket/tunnel has been closed during the same timer tick.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants