summaryrefslogtreecommitdiff
path: root/src/ipc_connecter.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:28 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:28 +0900
commit290705f05fb84088c6da1448223cbb32d5e5b200 (patch)
tree45f571a54cc1f8fa6dc570ce88f0d5cbdf3bf77f /src/ipc_connecter.cpp
parent858b8ad76757624464c139be2367f0dce53f8c3b (diff)
handle_valid removed from tcp_connecter_t and ipc_connecter_t
Invalid handle is now specified as handle == NULL Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/ipc_connecter.cpp')
-rw-r--r--src/ipc_connecter.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp
index 14d4355..f6a01c3 100644
--- a/src/ipc_connecter.cpp
+++ b/src/ipc_connecter.cpp
@@ -43,7 +43,7 @@ xs::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
own_t (io_thread_, options_),
io_object_t (io_thread_),
s (retired_fd),
- handle_valid (false),
+ handle (NULL),
wait (wait_),
session (session_),
current_reconnect_ivl(options.reconnect_ivl),
@@ -61,8 +61,10 @@ xs::ipc_connecter_t::~ipc_connecter_t ()
xs_assert (reconnect_timer);
rm_timer (reconnect_timer);
}
- if (handle_valid)
+ if (handle) {
rm_fd (handle);
+ handle = NULL;
+ }
if (s != retired_fd)
close ();
@@ -87,8 +89,9 @@ void xs::ipc_connecter_t::in_event (fd_t fd_)
void xs::ipc_connecter_t::out_event (fd_t fd_)
{
fd_t fd = connect ();
+ xs_assert (handle);
rm_fd (handle);
- handle_valid = false;
+ handle = NULL;
// Handle the error condition by attempt to reconnect.
if (fd == retired_fd) {
@@ -124,16 +127,16 @@ void xs::ipc_connecter_t::start_connecting ()
// Connect may succeed in synchronous manner.
if (rc == 0) {
+ xs_assert (!handle);
handle = add_fd (s);
- handle_valid = true;
out_event (s);
return;
}
// Connection establishment may be delayed. Poll for its completion.
else if (rc == -1 && errno == EAGAIN) {
+ xs_assert (!handle);
handle = add_fd (s);
- handle_valid = true;
set_pollout (handle);
return;
}