Merge pull request #2924 from sigiesec/tcp-cleanup

Problem: duplicated code, redundant member handle_valid, asymmetry between tcp_connecter and tcp_listener
This commit is contained in:
Luca Boccassi
2018-02-08 21:57:46 +00:00
committed by GitHub
3 changed files with 36 additions and 34 deletions

View File

@@ -70,6 +70,9 @@ class tcp_connecter_t : public own_t, public io_object_t
void out_event ();
void timer_event (int id_);
// Removes the handle from the poller.
void rm_handle ();
// Internal function to start the actual connection establishment.
void start_connecting ();
@@ -96,19 +99,19 @@ class tcp_connecter_t : public own_t, public io_object_t
// retired_fd if the connection was unsuccessful.
fd_t connect ();
// Tunes a connected socket.
bool tune_socket (fd_t fd);
// Address to connect to. Owned by session_base_t.
address_t *const addr;
// Underlying socket.
fd_t s;
// Handle corresponding to the listening socket.
// Handle corresponding to the listening socket, if file descriptor is
// registered with the poller, or NULL.
handle_t handle;
// If true file descriptor is registered with the poller and 'handle'
// contains valid value.
bool handle_valid;
// If true, connecter is waiting a while before trying to connect.
const bool delayed_start;