mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Problem: several data members in stream_connecter_base_t are visible more than necessary
Solution: make them private and adapt initialization order
This commit is contained in:
parent
a766a4b67e
commit
a40a3b7a34
@ -44,11 +44,11 @@ zmq::stream_connecter_base_t::stream_connecter_base_t (
|
||||
_addr (addr_),
|
||||
_s (retired_fd),
|
||||
_handle (static_cast<handle_t> (NULL)),
|
||||
_socket (session_->get_socket ()),
|
||||
_delayed_start (delayed_start_),
|
||||
_reconnect_timer_started (false),
|
||||
_session (session_),
|
||||
_current_reconnect_ivl (options.reconnect_ivl),
|
||||
_socket (_session->get_socket ())
|
||||
_current_reconnect_ivl (options.reconnect_ivl)
|
||||
{
|
||||
zmq_assert (_addr);
|
||||
_addr->to_string (_endpoint);
|
||||
|
@ -53,21 +53,6 @@ class stream_connecter_base_t : public own_t, public io_object_t
|
||||
|
||||
~stream_connecter_base_t ();
|
||||
|
||||
private:
|
||||
// ID of the timer used to delay the reconnection.
|
||||
enum
|
||||
{
|
||||
reconnect_timer_id = 1
|
||||
};
|
||||
|
||||
// Internal function to return a reconnect backoff delay.
|
||||
// Will modify the current_reconnect_ivl used for next call
|
||||
// Returns the currently used interval
|
||||
int get_new_reconnect_ivl ();
|
||||
|
||||
virtual void start_connecting () = 0;
|
||||
|
||||
// TODO check if some members can be made private
|
||||
protected:
|
||||
// Handlers for incoming commands.
|
||||
void process_plug ();
|
||||
@ -100,6 +85,26 @@ class stream_connecter_base_t : public own_t, public io_object_t
|
||||
// registered with the poller, or NULL.
|
||||
handle_t _handle;
|
||||
|
||||
// String representation of endpoint to connect to
|
||||
std::string _endpoint;
|
||||
|
||||
// Socket
|
||||
zmq::socket_base_t *const _socket;
|
||||
|
||||
private:
|
||||
// ID of the timer used to delay the reconnection.
|
||||
enum
|
||||
{
|
||||
reconnect_timer_id = 1
|
||||
};
|
||||
|
||||
// Internal function to return a reconnect backoff delay.
|
||||
// Will modify the current_reconnect_ivl used for next call
|
||||
// Returns the currently used interval
|
||||
int get_new_reconnect_ivl ();
|
||||
|
||||
virtual void start_connecting () = 0;
|
||||
|
||||
// If true, connecter is waiting a while before trying to connect.
|
||||
const bool _delayed_start;
|
||||
|
||||
@ -112,13 +117,6 @@ class stream_connecter_base_t : public own_t, public io_object_t
|
||||
// Current reconnect ivl, updated for backoff strategy
|
||||
int _current_reconnect_ivl;
|
||||
|
||||
// String representation of endpoint to connect to
|
||||
std::string _endpoint;
|
||||
|
||||
// Socket
|
||||
zmq::socket_base_t *const _socket;
|
||||
|
||||
private:
|
||||
stream_connecter_base_t (const stream_connecter_base_t &);
|
||||
const stream_connecter_base_t &operator= (const stream_connecter_base_t &);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user