ITADN

Refactor: simplify non-blocking socket connect code

#2605Pull RequestFooBarWidget 创建于 2025-04-09已合并
F
FooBarWidgetcommented
Get rid of NXXX_State. The old structure split up socket fd creation and connection establishment mainly because pingTcpSocket() needed to connect twice on the same fd. However, I discovered pingTcpSocket() was just doing things wrong: instead of connecting on the same fd again after having polled for writability, we're supposed to use getsockopt(SO_ERROR) to check whether the connection establishment was successful. By doing so, the NXXX_State structure is no longer necessary, so we now put non-blocking socket connection establishment code in single, simple functions. Introduces: - createNonBlockingSocketConnection() - createNonBlockingUnixSocketConnection() - createNonBlockingTcpSocketConnection()
合并状态:已合并 合并于 2025-04-18 关闭于 2025-04-18 0 条评论