asio: Rename http2::listen as http2::listen_and_serve
This commit is contained in:
parent
992c14e354
commit
34ac90443f
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
|
||||||
res.end("finally!\n");
|
res.end("finally!\n");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen("*", port);
|
server.listen_and_serve("*", port);
|
||||||
|
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
std::cerr << "exception: " << e.what() << "\n";
|
std::cerr << "exception: " << e.what() << "\n";
|
||||||
|
|
|
@ -99,7 +99,7 @@ int main(int argc, char *argv[]) {
|
||||||
res.end(file_generator_from_fd(fd));
|
res.end(file_generator_from_fd(fd));
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen("*", port);
|
server.listen_and_serve("*", port);
|
||||||
|
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
std::cerr << "exception: " << e.what() << "\n";
|
std::cerr << "exception: " << e.what() << "\n";
|
||||||
|
|
|
@ -41,8 +41,8 @@ http2::http2() : impl_(make_unique<http2_impl>()) {}
|
||||||
|
|
||||||
http2::~http2() {}
|
http2::~http2() {}
|
||||||
|
|
||||||
void http2::listen(const std::string &address, uint16_t port) {
|
void http2::listen_and_serve(const std::string &address, uint16_t port) {
|
||||||
impl_->listen(address, port);
|
impl_->listen_and_serve(address, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void http2::num_threads(size_t num_threads) { impl_->num_threads(num_threads); }
|
void http2::num_threads(size_t num_threads) { impl_->num_threads(num_threads); }
|
||||||
|
@ -66,7 +66,7 @@ std::vector<unsigned char> &get_alpn_token() {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void http2_impl::listen(const std::string &address, uint16_t port) {
|
void http2_impl::listen_and_serve(const std::string &address, uint16_t port) {
|
||||||
std::unique_ptr<boost::asio::ssl::context> ssl_ctx;
|
std::unique_ptr<boost::asio::ssl::context> ssl_ctx;
|
||||||
|
|
||||||
if (!private_key_file_.empty() && !certificate_file_.empty()) {
|
if (!private_key_file_.empty() && !certificate_file_.empty()) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ class server;
|
||||||
class http2_impl {
|
class http2_impl {
|
||||||
public:
|
public:
|
||||||
http2_impl();
|
http2_impl();
|
||||||
void listen(const std::string &address, uint16_t port);
|
void listen_and_serve(const std::string &address, uint16_t port);
|
||||||
void num_threads(size_t num_threads);
|
void num_threads(size_t num_threads);
|
||||||
void tls(std::string private_key_file, std::string certificate_file);
|
void tls(std::string private_key_file, std::string certificate_file);
|
||||||
void backlog(int backlog);
|
void backlog(int backlog);
|
||||||
|
|
|
@ -128,7 +128,7 @@ public:
|
||||||
|
|
||||||
// Starts listening connection on given address and port and serves
|
// Starts listening connection on given address and port and serves
|
||||||
// incoming requests.
|
// incoming requests.
|
||||||
void listen(const std::string &address, uint16_t port);
|
void listen_and_serve(const std::string &address, uint16_t port);
|
||||||
|
|
||||||
// Registers request handler |cb| with path pattern |pattern|. This
|
// Registers request handler |cb| with path pattern |pattern|. This
|
||||||
// function will fail and returns false if same pattern has been
|
// function will fail and returns false if same pattern has been
|
||||||
|
|
Loading…
Reference in New Issue