Skip to content

Conversation

@TyKonKet
Copy link

This pull request improves the connection logic in the ModbusTcpClient initialization to handle connection timeouts more robustly. The main change ensures that exceptions from failed connection attempts are properly observed, preventing potential process crashes or excessive logging.

Connection handling improvements:

  • Updated the connection logic in ModbusTcpClient.cs to observe exceptions from failed ConnectAsync tasks by attaching a continuation that accesses task.Exception, ensuring unhandled exceptions do not crash the process or flood logs. Also, the TcpClient is explicitly closed on timeout to cancel the connection attempt.

Ensure exceptions from ConnectAsync are observed to prevent unhandled task exceptions. Close TcpClient on timeout to cancel pending connections and enhance robustness against connection failures.
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