You've already forked cpp-httplib
Fixed problem with is_socket_alive
This commit is contained in:
@@ -2338,9 +2338,11 @@ inline bool wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec) {
|
||||
}
|
||||
|
||||
inline bool is_socket_alive(socket_t sock) {
|
||||
if (detail::select_read(sock, 0, 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
char buf[1];
|
||||
return detail::select_read(sock, 0, 0) &&
|
||||
recv(sock, &buf[0], sizeof(buf), MSG_PEEK) != 0;
|
||||
return recv(sock, &buf[0], sizeof(buf), MSG_PEEK) > 0;
|
||||
}
|
||||
|
||||
class SocketStream : public Stream {
|
||||
|
Reference in New Issue
Block a user