time_t rconn_get_last_connection(const struct rconn *);
time_t rconn_get_creation_time(const struct rconn *);
unsigned long int rconn_get_total_time_connected(const struct rconn *);
+int rconn_get_backoff(const struct rconn *);
+unsigned int rconn_get_state_elapsed(const struct rconn *);
#endif /* rconn.h */
return (rc->total_time_connected
+ (rconn_is_connected(rc) ? elapsed_in_this_state(rc) : 0));
}
+
+/* Returns the current amount of backoff, in seconds. This is the amount of
+ * time after which the rconn will transition from BACKOFF to CONNECTING. */
+int
+rconn_get_backoff(const struct rconn *rc)
+{
+ return rc->backoff;
+}
+
+/* Returns the number of seconds spent in this state so far. */
+unsigned int
+rconn_get_state_elapsed(const struct rconn *rc)
+{
+ return elapsed_in_this_state(rc);
+}
\f
/* Tries to send a packet from 'rc''s send buffer. Returns 0 if successful,
* otherwise a positive errno value. */
status_reply_put(sr, "name=%s", rconn_get_name(rconn));
status_reply_put(sr, "state=%s", rconn_get_state(rconn));
+ status_reply_put(sr, "backoff=%d", rconn_get_backoff(rconn));
status_reply_put(sr, "is-connected=%s",
rconn_is_connected(rconn) ? "true" : "false");
status_reply_put(sr, "sent-msgs=%u", rconn_packets_sent(rconn));
(long int) (now - rconn_get_last_connection(rconn)));
status_reply_put(sr, "time-connected=%lu",
rconn_get_total_time_connected(rconn));
+ status_reply_put(sr, "state-elapsed=%u", rconn_get_state_elapsed(rconn));
}
static void