Problem: formatting inconsistent

Solution: applied clang-format
This commit is contained in:
sigiesec
2018-02-01 11:46:09 +01:00
parent 6d8baea714
commit 41f459e1dc
331 changed files with 13208 additions and 13691 deletions

View File

@@ -51,8 +51,10 @@
#include <sys/socket.h>
zmq::tipc_connecter_t::tipc_connecter_t (class io_thread_t *io_thread_,
class session_base_t *session_, const options_t &options_,
const address_t *addr_, bool delayed_start_) :
class session_base_t *session_,
const options_t &options_,
const address_t *addr_,
bool delayed_start_) :
own_t (io_thread_, options_),
io_object_t (io_thread_),
addr (addr_),
@@ -61,12 +63,12 @@ zmq::tipc_connecter_t::tipc_connecter_t (class io_thread_t *io_thread_,
delayed_start (delayed_start_),
timer_started (false),
session (session_),
current_reconnect_ivl(options.reconnect_ivl)
current_reconnect_ivl (options.reconnect_ivl)
{
zmq_assert (addr);
zmq_assert (addr->protocol == "tipc");
addr->to_string (endpoint);
socket = session-> get_socket();
socket = session->get_socket ();
}
zmq::tipc_connecter_t::~tipc_connecter_t ()
@@ -89,7 +91,7 @@ void zmq::tipc_connecter_t::process_term (int linger_)
if (timer_started) {
cancel_timer (reconnect_timer_id);
timer_started = false;
}
}
if (handle_valid) {
rm_fd (handle);
@@ -119,11 +121,12 @@ void zmq::tipc_connecter_t::out_event ()
// Handle the error condition by attempt to reconnect.
if (fd == retired_fd) {
close ();
add_reconnect_timer();
add_reconnect_timer ();
return;
}
// Create the engine object for this connection.
stream_engine_t *engine = new (std::nothrow) stream_engine_t (fd, options, endpoint);
stream_engine_t *engine =
new (std::nothrow) stream_engine_t (fd, options, endpoint);
alloc_assert (engine);
// Attach the engine to the corresponding session object.
@@ -155,12 +158,11 @@ void zmq::tipc_connecter_t::start_connecting ()
}
// Connection establishment may be delayed. Poll for its completion.
else
if (rc == -1 && errno == EINPROGRESS) {
else if (rc == -1 && errno == EINPROGRESS) {
handle = add_fd (s);
handle_valid = true;
set_pollout (handle);
socket->event_connect_delayed (endpoint, zmq_errno());
socket->event_connect_delayed (endpoint, zmq_errno ());
}
// Handle any other error condition by eventual reconnect.
@@ -171,9 +173,9 @@ void zmq::tipc_connecter_t::start_connecting ()
}
}
void zmq::tipc_connecter_t::add_reconnect_timer()
void zmq::tipc_connecter_t::add_reconnect_timer ()
{
int rc_ivl = get_new_reconnect_ivl();
int rc_ivl = get_new_reconnect_ivl ();
add_timer (rc_ivl, reconnect_timer_id);
socket->event_connect_retried (endpoint, rc_ivl);
timer_started = true;
@@ -182,21 +184,20 @@ void zmq::tipc_connecter_t::add_reconnect_timer()
int zmq::tipc_connecter_t::get_new_reconnect_ivl ()
{
// The new interval is the current interval + random value.
int this_interval = current_reconnect_ivl +
(generate_random () % options.reconnect_ivl);
int this_interval =
current_reconnect_ivl + (generate_random () % options.reconnect_ivl);
// Only change the current reconnect interval if the maximum reconnect
// interval was set and if it's larger than the reconnect interval.
if (options.reconnect_ivl_max > 0 &&
options.reconnect_ivl_max > options.reconnect_ivl) {
if (options.reconnect_ivl_max > 0
&& options.reconnect_ivl_max > options.reconnect_ivl) {
// Calculate the next interval
current_reconnect_ivl = current_reconnect_ivl * 2;
if(current_reconnect_ivl >= options.reconnect_ivl_max) {
if (current_reconnect_ivl >= options.reconnect_ivl_max) {
current_reconnect_ivl = options.reconnect_ivl_max;
}
}
return this_interval;
return this_interval;
}
int zmq::tipc_connecter_t::open ()
@@ -211,9 +212,8 @@ int zmq::tipc_connecter_t::open ()
// Set the non-blocking flag.
unblock_socket (s);
// Connect to the remote peer.
int rc = ::connect (
s, addr->resolved.tipc_addr->addr (),
addr->resolved.tipc_addr->addrlen ());
int rc = ::connect (s, addr->resolved.tipc_addr->addr (),
addr->resolved.tipc_addr->addrlen ());
// Connect was successful immediately.
if (rc == 0)
@@ -245,17 +245,16 @@ zmq::fd_t zmq::tipc_connecter_t::connect ()
int err = 0;
socklen_t len = sizeof (err);
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char*) &err, &len);
int rc = getsockopt (s, SOL_SOCKET, SO_ERROR, (char *) &err, &len);
if (rc == -1)
err = errno;
if (err != 0) {
// Assert if the error was caused by 0MQ bug.
// Networking problems are OK. No need to assert.
errno = err;
errno_assert (errno == ECONNREFUSED || errno == ECONNRESET ||
errno == ETIMEDOUT || errno == EHOSTUNREACH ||
errno == ENETUNREACH || errno == ENETDOWN);
errno_assert (errno == ECONNREFUSED || errno == ECONNRESET
|| errno == ETIMEDOUT || errno == EHOSTUNREACH
|| errno == ENETUNREACH || errno == ENETDOWN);
return retired_fd;
}
@@ -265,4 +264,3 @@ zmq::fd_t zmq::tipc_connecter_t::connect ()
}
#endif