Skip to content

Commit 5db7d2c

Browse files
committed
moveonly: move IsSelectableSocket() from compat.h to sock.{h,cpp}
To be converted to a method of the `Sock` class.
1 parent 5c82ca3 commit 5db7d2c

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/compat/compat.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ typedef char* sockopt_arg_type;
109109
#define USE_POLL
110110
#endif
111111

112-
bool static inline IsSelectableSocket(const SOCKET& s) {
113-
#if defined(USE_POLL) || defined(WIN32)
114-
return true;
115-
#else
116-
return (s < FD_SETSIZE);
117-
#endif
118-
}
119-
120112
// MSG_NOSIGNAL is not available on some platforms, if it doesn't exist define it as 0
121113
#if !defined(MSG_NOSIGNAL)
122114
#define MSG_NOSIGNAL 0

src/util/sock.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ int Sock::GetSockName(sockaddr* name, socklen_t* name_len) const
117117
return getsockname(m_socket, name, name_len);
118118
}
119119

120+
bool IsSelectableSocket(const SOCKET& s) {
121+
#if defined(USE_POLL) || defined(WIN32)
122+
return true;
123+
#else
124+
return (s < FD_SETSIZE);
125+
#endif
126+
}
127+
120128
bool Sock::Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred) const
121129
{
122130
// We need a `shared_ptr` owning `this` for `WaitMany()`, but don't want

src/util/sock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ class Sock
267267
void Close();
268268
};
269269

270+
bool IsSelectableSocket(const SOCKET& s);
271+
270272
/** Return readable error string for a network error code */
271273
std::string NetworkErrorString(int err);
272274

0 commit comments

Comments
 (0)