Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Expose OS-chosen address and port; force IPv4#707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
eile wants to merge3 commits intocpp-netlib:0.11-develfromBlueBrain:0.11-bbp
Closed
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
Expose OS-chosen address and port; force IPv4
  • Loading branch information
@tribal-tec
tribal-tec committedNov 10, 2016
commitb886faa8b45ed69f10e1182cef4306eaa09ef525
11 changes: 6 additions & 5 deletionsCMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,12 +4,13 @@
# http://www.boost.org/LICENSE_1_0.txt)

cmake_minimum_required(VERSION 2.8)
project(CPP-NETLIB)
cmake_policy(SET CMP0048 NEW) # The project() command manages VERSION variables.
project(CPP-NETLIB VERSION 0.11.1)

option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries."OFF )
option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests."ON)
option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments."ON)
option( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples."ON)
option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries."ON )
option( CPP-NETLIB_BUILD_TESTS "Build the cpp-netlib project tests."OFF)
option( CPP-NETLIB_BUILD_EXPERIMENTS "Build the cpp-netlib project experiments."OFF)
option( CPP-NETLIB_BUILD_EXAMPLES "Build the cpp-netlib project examples."OFF)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm not comfortable with changing these defaults. Is there a reason why you don't set these from your project?

anonimal reacted with thumbs up emoji
option( CPP-NETLIB_ENABLE_HTTPS "Build cpp-netlib with support for https if OpenSSL is found." ON)

include(GNUInstallDirs)
Expand Down
7 changes: 6 additions & 1 deletionboost/network/protocol/http/server/sync_server.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,6 +62,9 @@ struct sync_server_base : server_storage_base, socket_options_base {
if (!listening_) start_listening();
}

const string_type& address() const { return address_; }
const string_type& port() const { return port_; }

private:
Handler& handler_;
string_type address_, port_;
Expand All@@ -86,7 +89,7 @@ struct sync_server_base : server_storage_base, socket_options_base {
using boost::asio::ip::tcp;
system::error_code error;
tcp::resolver resolver(service_);
tcp::resolver::query query(address_, port_);
tcp::resolver::query query(tcp::v4(),address_, port_);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

There seems to be no reason for this -- can you not make this explicit in your code instead? As part of the options?

tcp::resolver::iterator endpoint_iterator = resolver.resolve(query, error);
if (error) {
BOOST_NETWORK_MESSAGE("Error resolving address: " << address_ << ':'
Expand All@@ -109,6 +112,8 @@ struct sync_server_base : server_storage_base, socket_options_base {
<< error << '\'');
boost::throw_exception(std::runtime_error("Error binding to socket."));
}
address_ = acceptor_.local_endpoint().address().to_v4().to_string();
port_ = std::to_string(acceptor_.local_endpoint().port());
acceptor_.listen(tcp::socket::max_connections, error);
if (error) {
BOOST_NETWORK_MESSAGE("Error listening on socket: "
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp