-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix connect timeout not accounting for DNS resolution time #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e3a20d1
ea0d4a6
1ac34d6
899eb0d
d19257f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ target_link_libraries(hmutex_test -lpthread) | |
| add_executable(connect_test connect_test.c ../base/hsocket.c ../base/htime.c) | ||
| target_include_directories(connect_test PRIVATE .. ../base) | ||
|
|
||
| add_executable(socketpair_test socketpair_test.c ../base/hsocket.c) | ||
| add_executable(socketpair_test socketpair_test.c ../base/hsocket.c ../base/htime.c) | ||
| target_include_directories(socketpair_test PRIVATE .. ../base) | ||
|
|
||
| # ------util------ | ||
|
|
@@ -73,17 +73,17 @@ target_include_directories(objectpool_test PRIVATE .. ../base ../cpputil) | |
| target_link_libraries(objectpool_test -lpthread) | ||
|
|
||
| # ------protocol------ | ||
| add_executable(nslookup nslookup_test.c ../protocol/dns.c) | ||
| add_executable(nslookup nslookup_test.c ../protocol/dns.c ../base/hsocket.c ../base/htime.c) | ||
| target_include_directories(nslookup PRIVATE .. ../base ../protocol) | ||
|
|
||
| add_executable(ping ping_test.c ../protocol/icmp.c ../base/hsocket.c ../base/htime.c) | ||
| target_compile_definitions(ping PRIVATE -DPRINT_DEBUG) | ||
| target_include_directories(ping PRIVATE .. ../base ../protocol) | ||
|
|
||
| add_executable(ftp ftp_test.c ../protocol/ftp.c ../base/hsocket.c) | ||
| add_executable(ftp ftp_test.c ../protocol/ftp.c ../base/hsocket.c ../base/htime.c) | ||
| target_include_directories(ftp PRIVATE .. ../base ../protocol) | ||
|
|
||
| add_executable(sendmail sendmail_test.c ../protocol/smtp.c ../base/hsocket.c ../util/base64.c) | ||
| add_executable(sendmail sendmail_test.c ../protocol/smtp.c ../base/hsocket.c ../base/htime.c ../util/base64.c) | ||
| target_include_directories(sendmail PRIVATE .. ../base ../protocol ../util) | ||
|
Comment on lines
+83
to
87
|
||
|
|
||
| if(UNIX) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot 这里需要closesocket(connfd)吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,已修复。改为显式调用
closesocket(connfd)并直接返回-ETIMEDOUT,不再依赖socket_errno_negative()(在 Windows 上它读取WSAGetLastError()而非errno,可能返回错误的错误码)。见 d19257f。