From 7df824b7b2aa6c8ab54af3193add82d6ed940785 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 26 Jun 2009 16:00:07 -0700 Subject: [PATCH] Log more rconn status. --- lib/rconn.c | 9 +++++++++ lib/rconn.h | 1 + secchan/status.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/lib/rconn.c b/lib/rconn.c index deb95195..b18a2e59 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -698,6 +698,15 @@ rconn_get_last_connection(const struct rconn *rc) return rc->last_connected; } +/* Returns the time at which the last OpenFlow message was received by 'rc'. + * If no packets have been received on 'rc', returns the time at which 'rc' + * was created. */ +time_t +rconn_get_last_received(const struct rconn *rc) +{ + return rc->last_received; +} + /* Returns the time at which 'rc' was created. */ time_t rconn_get_creation_time(const struct rconn *rc) diff --git a/lib/rconn.h b/lib/rconn.h index f9cbe706..1249b844 100644 --- a/lib/rconn.h +++ b/lib/rconn.h @@ -78,6 +78,7 @@ const char *rconn_get_state(const struct rconn *); unsigned int rconn_get_attempted_connections(const struct rconn *); unsigned int rconn_get_successful_connections(const struct rconn *); time_t rconn_get_last_connection(const struct rconn *); +time_t rconn_get_last_received(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 *); diff --git a/secchan/status.c b/secchan/status.c index 4d3f4113..1dedb8df 100644 --- a/secchan/status.c +++ b/secchan/status.c @@ -106,6 +106,8 @@ rconn_status_cb(struct status_reply *sr, void *rconn_) rconn_get_successful_connections(rconn)); status_reply_put(sr, "last-connection=%ld", (long int) (now - rconn_get_last_connection(rconn))); + status_reply_put(sr, "last-received=%ld", + (long int) (now - rconn_get_last_received(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)); -- 2.30.2