BewareMyPower opened a new pull request #11329: URL: https://github.com/apache/pulsar/pull/11329
### Motivation When the Pulsar C++ library was deployed to a Windows server, the program would crash after the connection is connected. Though it works on Windows 10. It's caused by the Boost socket `set_option` method. Some socket options are not portable like `TCP_KEEPCNT` and `TCP_KEEPINTVL`, which are defined in system headers. The default behavior of `set_option` method is throwing an exception if the socket option is not supported. ### Modifications Replace the `set_option` calls with another overload signature that stores the error into a `boost::system::error_code` instead of throwing a `boost::system::system_error`. For Boost's builtin socket options, use warning level logs. For platform dependent socket options, use debug level logs. References: - https://www.boost.org/doc/libs/1_76_0/doc/html/boost_asio/reference/basic_socket/set_option/overload1.html - https://www.boost.org/doc/libs/1_76_0/doc/html/boost_asio/reference/basic_socket/set_option/overload2.html ### Verifying this change - [ ] Make sure that the change passes the CI checks. This change is a trivial rework / code cleanup without any test coverage. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
