mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-15 10:39:37 +00:00
Specifying "Server::stop()" as noexcept (#2451)
* The current implementation of "Server::stop()" doesn't throw an exception, so why not specify this explicitly? * Adding the missing "noexcept" to the declaration
This commit is contained in:
1 parent
28f8264d13
commit
b1cc8095a8
1 file changed
+5
-7
@@ -1597,7 +1597,7 @@ private:
|
|||||||
std::regex regex_;
|
std::regex regex_;
|
||||||
};
|
};
|
||||||
|
|
||||||
int close_socket(socket_t sock);
|
int close_socket(socket_t sock) noexcept;
|
||||||
|
|
||||||
ssize_t write_headers(Stream &strm, const Headers &headers);
|
ssize_t write_headers(Stream &strm, const Headers &headers);
|
||||||
|
|
||||||
@@ -1734,7 +1734,7 @@ public:
|
|||||||
|
|
||||||
bool is_running() const;
|
bool is_running() const;
|
||||||
void wait_until_ready() const;
|
void wait_until_ready() const;
|
||||||
void stop();
|
void stop() noexcept;
|
||||||
void decommission();
|
void decommission();
|
||||||
|
|
||||||
std::function<TaskQueue *(void)> new_task_queue;
|
std::function<TaskQueue *(void)> new_task_queue;
|
||||||
@@ -3028,8 +3028,6 @@ bool parse_range_header(const std::string &s, Ranges &ranges);
|
|||||||
bool parse_accept_header(const std::string &s,
|
bool parse_accept_header(const std::string &s,
|
||||||
std::vector<std::string> &content_types);
|
std::vector<std::string> &content_types);
|
||||||
|
|
||||||
int close_socket(socket_t sock);
|
|
||||||
|
|
||||||
ssize_t send_socket(socket_t sock, const void *ptr, size_t size, int flags);
|
ssize_t send_socket(socket_t sock, const void *ptr, size_t size, int flags);
|
||||||
|
|
||||||
ssize_t read_socket(socket_t sock, void *ptr, size_t size, int flags);
|
ssize_t read_socket(socket_t sock, void *ptr, size_t size, int flags);
|
||||||
@@ -5422,7 +5420,7 @@ inline void mmap::close() {
|
|||||||
#endif
|
#endif
|
||||||
size_ = 0;
|
size_ = 0;
|
||||||
}
|
}
|
||||||
inline int close_socket(socket_t sock) {
|
inline int close_socket(socket_t sock) noexcept {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return closesocket(sock);
|
return closesocket(sock);
|
||||||
#else
|
#else
|
||||||
@@ -5649,7 +5647,7 @@ inline bool process_client_socket(
|
|||||||
return callback(strm);
|
return callback(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int shutdown_socket(socket_t sock) {
|
inline int shutdown_socket(socket_t sock) noexcept {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return shutdown(sock, SD_BOTH);
|
return shutdown(sock, SD_BOTH);
|
||||||
#else
|
#else
|
||||||
@@ -11004,7 +11002,7 @@ inline void Server::wait_until_ready() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Server::stop() {
|
inline void Server::stop() noexcept {
|
||||||
if (is_running_) {
|
if (is_running_) {
|
||||||
assert(svr_sock_ != INVALID_SOCKET);
|
assert(svr_sock_ != INVALID_SOCKET);
|
||||||
std::atomic<socket_t> sock(svr_sock_.exchange(INVALID_SOCKET));
|
std::atomic<socket_t> sock(svr_sock_.exchange(INVALID_SOCKET));
|
||||||
|
|||||||
Reference in new issue
Block a user