Skip to content

Commit

Permalink
[src] Make Connecting::DoWithError() adapting to UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigma711 committed Aug 28, 2023
1 parent 7ba7ed1 commit 5653a96
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/connecting.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ void Connecting::DoClosing() {
}
}
void Connecting::DoWithError() const {
#ifdef __linux__
int opt_val;
auto opt_len = static_cast<socklen_t>(sizeof(opt_val));
int saved_errno;
Expand All @@ -114,6 +115,9 @@ void Connecting::DoWithError() const {
} else {
saved_errno = opt_val;
}
#else
int saved_errno = errno;
#endif
char errno_info[512];
::strerror_r(saved_errno, errno_info, sizeof(errno_info));
LOG_ERROR("Fd(%d) gets an error -- %s!!!", Fd(), errno_info);
Expand Down

0 comments on commit 5653a96

Please sign in to comment.