Skip to content

Commit

Permalink
maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
Neverlord committed Oct 19, 2012
1 parent 94adf39 commit 7940555
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cppa/network/ipv4_acceptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ipv4_acceptor : public acceptor {
public:

static std::unique_ptr<acceptor> create(std::uint16_t port,
const char* addr);
const char* addr = nullptr);

~ipv4_acceptor();

Expand Down
11 changes: 4 additions & 7 deletions src/default_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,27 @@ atom_value default_protocol::identifier() const {
}

void default_protocol::publish(const actor_ptr& whom, variant_args args) {
CPPA_LOG_TRACE("whom: " << to_string(whom)
CPPA_LOG_TRACE(CPPA_TARG(whom, to_string)
<< ", args.size() = " << args.size());
if (!whom) return;
CPPA_REQUIRE(args.size() == 2 || args.size() == 1);
auto i = args.begin();
if (args.size() == 1) {
auto port = get<uint16_t>(*i++);
publish(whom,
unique_ptr<acceptor>(ipv4_acceptor::create(port, nullptr)),
{});
publish(whom, ipv4_acceptor::create(port), {});
}
else if (args.size() == 2) {
auto port = get<uint16_t>(*i++);
auto& addr = get<string>(*i);
publish(whom, unique_ptr<acceptor>(ipv4_acceptor::create(port, addr.c_str())), {});
publish(whom, ipv4_acceptor::create(port, addr.c_str()), {});
}
else throw logic_error("wrong number of arguments, expected one or two");
}

void default_protocol::publish(const actor_ptr& whom,
std::unique_ptr<acceptor> ptr,
variant_args args ) {
CPPA_LOG_TRACE("whom: " << to_string(whom)
<< ", ptr = " << ptr.get()
CPPA_LOG_TRACE(CPPA_TARG(whom, to_string) << ", " << CPPA_MARG(ptr, get)
<< ", args.size() = " << args.size());
if (!whom) return;
CPPA_REQUIRE(args.size() == 0);
Expand Down
2 changes: 1 addition & 1 deletion src/ipv4_acceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ipv4_acceptor::ipv4_acceptor(native_socket_type fd, bool nonblocking)
: m_fd(fd), m_is_nonblocking(nonblocking) { }

std::unique_ptr<acceptor> ipv4_acceptor::create(std::uint16_t port,
const char* addr) {
const char* addr) {
native_socket_type sockfd;
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd == invalid_socket) {
Expand Down

0 comments on commit 7940555

Please sign in to comment.