libnghttp2_asio: Optimized remote endpoint interface to const ref where possible

This commit is contained in:
Andreas Pohl 2015-12-19 14:08:15 +01:00
parent a30dad4f5e
commit 9f2d064d7c
6 changed files with 8 additions and 6 deletions

View File

@ -453,7 +453,9 @@ response *http2_handler::push_promise(boost::system::error_code &ec,
boost::asio::io_service &http2_handler::io_service() { return io_service_; }
boost::asio::ip::tcp::endpoint http2_handler::remote_endpoint() { return remote_ep_; }
const boost::asio::ip::tcp::endpoint &http2_handler::remote_endpoint() {
return remote_ep_;
}
callback_guard::callback_guard(http2_handler &h) : handler(h) {
handler.enter_callback();

View File

@ -90,7 +90,7 @@ public:
boost::asio::io_service &io_service();
boost::asio::ip::tcp::endpoint remote_endpoint();
const boost::asio::ip::tcp::endpoint &remote_endpoint();
const std::string &http_date();

View File

@ -50,7 +50,7 @@ void request::on_data(data_cb cb) const {
request_impl &request::impl() const { return *impl_; }
boost::asio::ip::tcp::endpoint request::remote_endpoint() const {
const boost::asio::ip::tcp::endpoint &request::remote_endpoint() const {
return impl_->remote_endpoint();
}

View File

@ -54,7 +54,7 @@ void request_impl::call_on_data(const uint8_t *data, std::size_t len) {
}
}
boost::asio::ip::tcp::endpoint request_impl::remote_endpoint() const {
const boost::asio::ip::tcp::endpoint &request_impl::remote_endpoint() const {
return remote_ep_;
}

View File

@ -55,7 +55,7 @@ public:
void stream(class stream *s);
void call_on_data(const uint8_t *data, std::size_t len);
boost::asio::ip::tcp::endpoint remote_endpoint() const;
const boost::asio::ip::tcp::endpoint &remote_endpoint() const;
void remote_endpoint(boost::asio::ip::tcp::endpoint ep);
private:

View File

@ -60,7 +60,7 @@ public:
request_impl &impl() const;
// Returns the remote endpoint of the request
boost::asio::ip::tcp::endpoint remote_endpoint() const;
const boost::asio::ip::tcp::endpoint &remote_endpoint() const;
private:
std::unique_ptr<request_impl> impl_;