|
@@ -217,7 +217,7 @@ inline socket_t create_server_socket(const char* host, int port)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-inline int close_server_socket(socket_t sock)
|
|
|
|
|
|
|
+inline int close_socket(socket_t sock)
|
|
|
{
|
|
{
|
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
|
shutdown(sock, SD_BOTH);
|
|
shutdown(sock, SD_BOTH);
|
|
@@ -241,15 +241,6 @@ inline socket_t create_client_socket(const char* host, int port)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-inline int close_client_socket(socket_t sock)
|
|
|
|
|
-{
|
|
|
|
|
-#ifdef _WIN32
|
|
|
|
|
- return closesocket(sock);
|
|
|
|
|
-#else
|
|
|
|
|
- return close(sock);
|
|
|
|
|
-#endif
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
inline const char* status_message(int status)
|
|
inline const char* status_message(int status)
|
|
|
{
|
|
{
|
|
|
const char* s = NULL;
|
|
const char* s = NULL;
|
|
@@ -485,7 +476,7 @@ inline bool Server::run()
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- close_server_socket(sock_);
|
|
|
|
|
|
|
+ close_socket(sock_);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -496,7 +487,7 @@ inline bool Server::run()
|
|
|
process_request(fp_read, fp_write);
|
|
process_request(fp_read, fp_write);
|
|
|
|
|
|
|
|
fflush(fp_write);
|
|
fflush(fp_write);
|
|
|
- close_server_socket(fd);
|
|
|
|
|
|
|
+ close_socket(fd);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// NOTREACHED
|
|
// NOTREACHED
|
|
@@ -504,7 +495,7 @@ inline bool Server::run()
|
|
|
|
|
|
|
|
inline void Server::stop()
|
|
inline void Server::stop()
|
|
|
{
|
|
{
|
|
|
- close_server_socket(sock_);
|
|
|
|
|
|
|
+ close_socket(sock_);
|
|
|
sock_ = -1;
|
|
sock_ = -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -674,7 +665,7 @@ inline bool Client::send(const Request& req, Response& res)
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- close_client_socket(sock);
|
|
|
|
|
|
|
+ close_socket(sock);
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|