summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ip.cpp2
-rw-r--r--src/ipc_listener.cpp6
-rw-r--r--src/req.cpp6
-rw-r--r--src/session_base.cpp10
-rw-r--r--src/socket_base.cpp36
-rw-r--r--src/tcp_listener.cpp6
-rw-r--r--src/upoll.cpp2
-rw-r--r--tests/hwm.cpp2
-rw-r--r--tests/reqrep_device.cpp1
9 files changed, 36 insertions, 35 deletions
diff --git a/src/ip.cpp b/src/ip.cpp
index bae8d7e..66177a7 100644
--- a/src/ip.cpp
+++ b/src/ip.cpp
@@ -84,7 +84,7 @@ void xs::tune_tcp_socket (fd_t s_, bool keepalive_)
if (keepalive_) {
int keepalive = 1;
- int rc = setsockopt (s_, SOL_SOCKET, SO_KEEPALIVE, (char*) &keepalive,
+ rc = setsockopt (s_, SOL_SOCKET, SO_KEEPALIVE, (char*) &keepalive,
sizeof (int));
#ifdef XS_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
diff --git a/src/ipc_listener.cpp b/src/ipc_listener.cpp
index bd2e5c7..b3e5693 100644
--- a/src/ipc_listener.cpp
+++ b/src/ipc_listener.cpp
@@ -83,11 +83,11 @@ void xs::ipc_listener_t::in_event (fd_t fd_)
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
- io_thread_t *io_thread = choose_io_thread (options.affinity);
- xs_assert (io_thread);
+ io_thread_t *thread = choose_io_thread (options.affinity);
+ xs_assert (thread);
// Create and launch a session object.
- session_base_t *session = session_base_t::create (io_thread, false, socket,
+ session_base_t *session = session_base_t::create (thread, false, socket,
options, NULL, NULL);
errno_assert (session);
session->inc_seqnum ();
diff --git a/src/req.cpp b/src/req.cpp
index 2e0e614..0094929 100644
--- a/src/req.cpp
+++ b/src/req.cpp
@@ -77,6 +77,8 @@ int xs::req_t::xsend (msg_t *msg_, int flags_)
int xs::req_t::xrecv (msg_t *msg_, int flags_)
{
+ int rc;
+
// If request wasn't send, we can't wait for reply.
if (!receiving_reply) {
errno = EFSM;
@@ -92,7 +94,7 @@ int xs::req_t::xrecv (msg_t *msg_, int flags_)
// TODO: This should also close the connection with the peer!
if (unlikely (!(msg_->flags () & msg_t::more) || msg_->size () != 0)) {
while (true) {
- int rc = xreq_t::xrecv (msg_, flags_);
+ rc = xreq_t::xrecv (msg_, flags_);
errno_assert (rc == 0);
if (!(msg_->flags () & msg_t::more))
break;
@@ -106,7 +108,7 @@ int xs::req_t::xrecv (msg_t *msg_, int flags_)
message_begins = false;
}
- int rc = xreq_t::xrecv (msg_, flags_);
+ rc = xreq_t::xrecv (msg_, flags_);
if (rc != 0)
return rc;
diff --git a/src/session_base.cpp b/src/session_base.cpp
index 0c9428b..90fa071 100644
--- a/src/session_base.cpp
+++ b/src/session_base.cpp
@@ -395,14 +395,14 @@ void xs::session_base_t::start_connecting (bool wait_)
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
- io_thread_t *io_thread = choose_io_thread (options.affinity);
+ io_thread_t *thread = choose_io_thread (options.affinity);
xs_assert (io_thread);
// Create the connecter object.
if (protocol == "tcp") {
tcp_connecter_t *connecter = new (std::nothrow) tcp_connecter_t (
- io_thread, this, options, address.c_str (), wait_);
+ thread, this, options, address.c_str (), wait_);
alloc_assert (connecter);
launch_child (connecter);
return;
@@ -411,7 +411,7 @@ void xs::session_base_t::start_connecting (bool wait_)
#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
if (protocol == "ipc") {
ipc_connecter_t *connecter = new (std::nothrow) ipc_connecter_t (
- io_thread, this, options, address.c_str (), wait_);
+ thread, this, options, address.c_str (), wait_);
alloc_assert (connecter);
launch_child (connecter);
return;
@@ -433,7 +433,7 @@ void xs::session_base_t::start_connecting (bool wait_)
// PGM sender.
pgm_sender_t *pgm_sender = new (std::nothrow) pgm_sender_t (
- io_thread, options);
+ thread, options);
alloc_assert (pgm_sender);
int rc = pgm_sender->init (udp_encapsulation, address.c_str ());
@@ -445,7 +445,7 @@ void xs::session_base_t::start_connecting (bool wait_)
// PGM receiver.
pgm_receiver_t *pgm_receiver = new (std::nothrow) pgm_receiver_t (
- io_thread, options);
+ thread, options);
alloc_assert (pgm_receiver);
int rc = pgm_receiver->init (udp_encapsulation, address.c_str ());
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 9d33348..fbb3b5e 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -325,17 +325,17 @@ int xs::socket_base_t::bind (const char *addr_)
// Remaining trasnports require to be run in an I/O thread, so at this
// point we'll choose one.
- io_thread_t *io_thread = choose_io_thread (options.affinity);
- if (!io_thread) {
+ io_thread_t *thread = choose_io_thread (options.affinity);
+ if (!thread) {
errno = EMTHREAD;
return -1;
}
if (protocol == "tcp") {
tcp_listener_t *listener = new (std::nothrow) tcp_listener_t (
- io_thread, this, options);
+ thread, this, options);
alloc_assert (listener);
- int rc = listener->set_address (address.c_str ());
+ rc = listener->set_address (address.c_str ());
if (rc != 0) {
delete listener;
return -1;
@@ -347,9 +347,9 @@ int xs::socket_base_t::bind (const char *addr_)
#if !defined XS_HAVE_WINDOWS && !defined XS_HAVE_OPENVMS
if (protocol == "ipc") {
ipc_listener_t *listener = new (std::nothrow) ipc_listener_t (
- io_thread, this, options);
+ thread, this, options);
alloc_assert (listener);
- int rc = listener->set_address (address.c_str ());
+ rc = listener->set_address (address.c_str ());
if (rc != 0) {
delete listener;
return -1;
@@ -407,14 +407,14 @@ int xs::socket_base_t::connect (const char *addr_)
// Create a bi-directional pipe to connect the peers.
object_t *parents [2] = {this, peer.socket};
- pipe_t *pipes [2] = {NULL, NULL};
+ pipe_t *ppair [2] = {NULL, NULL};
int hwms [2] = {sndhwm, rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
- int rc = pipepair (parents, pipes, hwms, delays, options.protocol);
+ rc = pipepair (parents, ppair, hwms, delays, options.protocol);
errno_assert (rc == 0);
// Attach local end of the pipe to this socket object.
- attach_pipe (pipes [0]);
+ attach_pipe (ppair [0]);
// If required, send the identity of the local socket to the peer.
if (options.send_identity) {
@@ -423,36 +423,36 @@ int xs::socket_base_t::connect (const char *addr_)
xs_assert (rc == 0);
memcpy (id.data (), options.identity, options.identity_size);
id.set_flags (msg_t::identity);
- bool written = pipes [0]->write (&id);
+ bool written = ppair [0]->write (&id);
xs_assert (written);
}
// Attach remote end of the pipe to the peer socket. Note that peer's
// seqnum was incremented in find_endpoint function. We don't need it
// increased here.
- send_bind (peer.socket, pipes [1], false);
+ send_bind (peer.socket, ppair [1], false);
return 0;
}
// Choose the I/O thread to run the session in.
- io_thread_t *io_thread = choose_io_thread (options.affinity);
- if (!io_thread) {
+ io_thread_t *thread = choose_io_thread (options.affinity);
+ if (!thread) {
errno = EMTHREAD;
return -1;
}
// Create session.
- session_base_t *session = session_base_t::create (io_thread, true, this,
+ session_base_t *session = session_base_t::create (thread, true, this,
options, protocol.c_str (), address.c_str ());
errno_assert (session);
// Create a bi-directional pipe.
object_t *parents [2] = {this, session};
- pipe_t *pipes [2] = {NULL, NULL};
+ pipe_t *ppair [2] = {NULL, NULL};
int hwms [2] = {options.sndhwm, options.rcvhwm};
bool delays [2] = {options.delay_on_disconnect, options.delay_on_close};
- rc = pipepair (parents, pipes, hwms, delays, options.protocol);
+ rc = pipepair (parents, ppair, hwms, delays, options.protocol);
errno_assert (rc == 0);
// PGM does not support subscription forwarding; ask for all data to be
@@ -462,10 +462,10 @@ int xs::socket_base_t::connect (const char *addr_)
icanhasall = true;
// Attach local end of the pipe to the socket object.
- attach_pipe (pipes [0], icanhasall);
+ attach_pipe (ppair [0], icanhasall);
// Attach remote end of the pipe to the session object later on.
- session->attach_pipe (pipes [1]);
+ session->attach_pipe (ppair [1]);
// Activate the session. Make it a child of this socket.
launch_child (session);
diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp
index c0ea564..5e1dcc9 100644
--- a/src/tcp_listener.cpp
+++ b/src/tcp_listener.cpp
@@ -94,11 +94,11 @@ void xs::tcp_listener_t::in_event (fd_t fd_)
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
- io_thread_t *io_thread = choose_io_thread (options.affinity);
- xs_assert (io_thread);
+ io_thread_t *thread = choose_io_thread (options.affinity);
+ xs_assert (thread);
// Create and launch a session object.
- session_base_t *session = session_base_t::create (io_thread, false, socket,
+ session_base_t *session = session_base_t::create (thread, false, socket,
options, NULL, NULL);
errno_assert (session);
session->inc_seqnum ();
diff --git a/src/upoll.cpp b/src/upoll.cpp
index 3295bba..9dd13ea 100644
--- a/src/upoll.cpp
+++ b/src/upoll.cpp
@@ -125,7 +125,7 @@ int xs::upoll (xs_pollitem_t *items_, int nitems_, int timeout_)
else if (timeout_ < 0)
timeout = -1;
else
- timeout = end - now;
+ timeout = (int) (end - now);
// Wait for events.
while (true) {
diff --git a/tests/hwm.cpp b/tests/hwm.cpp
index f93dcd9..6cd9a41 100644
--- a/tests/hwm.cpp
+++ b/tests/hwm.cpp
@@ -47,7 +47,7 @@ int XS_TEST_MAIN ()
// Try to send 10 messages. Only 4 should succeed.
for (int i = 0; i < 10; i++)
{
- int rc = xs_send (sc, NULL, 0, XS_DONTWAIT);
+ rc = xs_send (sc, NULL, 0, XS_DONTWAIT);
if (i < 4)
assert (rc == 0);
else
diff --git a/tests/reqrep_device.cpp b/tests/reqrep_device.cpp
index 54a9ed4..81960d9 100644
--- a/tests/reqrep_device.cpp
+++ b/tests/reqrep_device.cpp
@@ -101,7 +101,6 @@ int XS_TEST_MAIN ()
assert (rc == 0);
rc = xs_recvmsg (xreq, &msg, 0);
assert (rc >= 0);
- int rcvmore;
rc = xs_getsockopt (xreq, XS_RCVMORE, &rcvmore, &sz);
assert (rc == 0);
rc = xs_sendmsg (xrep, &msg, rcvmore ? XS_SNDMORE : 0);