| 5367 | } |
| 5368 | |
| 5369 | inline socket_t |
| 5370 | Server::create_server_socket(const char* host, int port, int socket_flags, |
| 5371 | SocketOptions socket_options) const { |
| 5372 | return detail::create_socket( |
| 5373 | host, "", port, address_family_, socket_flags, tcp_nodelay_, |
| 5374 | std::move(socket_options), |
| 5375 | [](socket_t sock, struct addrinfo& ai) -> bool { |
| 5376 | if (::bind(sock, ai.ai_addr, static_cast<socklen_t>(ai.ai_addrlen))) { |
| 5377 | return false; |
| 5378 | } |
| 5379 | if (::listen(sock, CPPHTTPLIB_LISTEN_BACKLOG)) { return false; } |
| 5380 | return true; |
| 5381 | }); |
| 5382 | } |
| 5383 | |
| 5384 | inline int Server::bind_internal(const char* host, int port, int socket_flags) { |
| 5385 | if (!is_valid()) { return -1; } |
nothing calls this directly
no test coverage detected