Skip to content

Commit 8311e11

Browse files
committed
Fix Windows build problem
1 parent ba68459 commit 8311e11

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

httplib.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,13 +2054,18 @@ inline uint64_t Response::get_header_value_u64(const std::string &key,
20542054

20552055
inline void default_socket_options(socket_t sock) {
20562056
int opt = 1;
2057+
#ifdef _WIN32
2058+
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
2059+
reinterpret_cast<const char *>(&opt), sizeof(opt));
2060+
#else
20572061
#ifdef SO_REUSEPORT
20582062
setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
20592063
reinterpret_cast<const void *>(&opt), sizeof(opt));
20602064
#else
20612065
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
20622066
reinterpret_cast<const void *>(&opt), sizeof(opt));
20632067
#endif
2068+
#endif
20642069
}
20652070

20662071
inline const char *status_message(int status) {

0 commit comments

Comments
 (0)