-
-
Notifications
You must be signed in to change notification settings - Fork 652
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve: connection management and error handling (#1986)
### Connection Management Refinements and Error Handling Improvements This PR implements several key changes, include: #### Enhanced Error Handling - More detailed logs for better debugging and error analysis. #### Simplification and Refactoring - Critical methods such as `Connection::close` and `Connection::accept` have been simplified and refactored for clarity. #### Precise Timeout Management - `std::chrono::milliseconds` implemented for more accurate timeout settings. #### Improved Protocol Management - Better handling of connection states and protocol management. #### Robust Socket Closure - Addition of `socket.cancel();` in `Connection::closeSocket()` ensures cancellation of pending asynchronous operations, increasing safety during socket closure. #### Safe Message Sending - State of the socket is now checked before sending messages, preventing attempts to write on closed sockets. #### Optimized Thread Safety - Utilization of `std::scoped_lock` and `std::unique_lock` optimized for safer thread handling. #### Improved IP and Timeout Handling - Enhancements in IP management and more efficient timeout handling.
- Loading branch information
Showing
3 changed files
with
104 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters