From 24cd5a603c74e4733eeaf61c18c06558e1fd28f4 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 26 Jan 2006 23:46:10 +0000 Subject: Make our own time type for use in monitoring. --- src/snmp-engine.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src/snmp-engine.c') diff --git a/src/snmp-engine.c b/src/snmp-engine.c index 8d39991..896e8e4 100644 --- a/src/snmp-engine.c +++ b/src/snmp-engine.c @@ -66,10 +66,10 @@ typedef struct _rb_request /* The SNMP request identifier */ uint32_t id; - uint64_t next_retry; /* Time of the next retry */ - uint64_t interval; /* How long between retries */ - uint64_t timeout; /* When this request times out */ - uint32_t sent; /* How many times we've sent */ + mstime next_retry; /* Time of the next retry */ + mstime interval; /* How long between retries */ + mstime timeout; /* When this request times out */ + uint sent; /* How many times we've sent */ /* The poller and host associated with this request */ rb_poller* poll; @@ -204,7 +204,7 @@ free_req(rb_request* req) */ static void -finish_poll(rb_poller* poll, uint64_t when) +finish_poll(rb_poller* poll, mstime when) { #ifdef _DEBUG { @@ -224,7 +224,7 @@ finish_poll(rb_poller* poll, uint64_t when) } static void -send_req(rb_request* req, uint64_t when) +send_req(rb_request* req, mstime when) { struct asn_buf b; ssize_t ret; @@ -251,7 +251,7 @@ send_req(rb_request* req, uint64_t when) } static void -timeout_req(rb_request* req, uint64_t when) +timeout_req(rb_request* req, mstime when) { rb_poller* poll = req->poll; int incomplete = 0; @@ -285,7 +285,7 @@ timeout_req(rb_request* req, uint64_t when) } static void -check_req(rb_request* req, uint64_t when) +check_req(rb_request* req, mstime when) { ASSERT(req->id); @@ -305,7 +305,7 @@ fprintf(stderr, "check_req timeout_req %lld %lld\n", when, req->timeout); } static void -respond_req(rb_request* req, struct snmp_pdu* pdu, uint64_t when) +respond_req(rb_request* req, struct snmp_pdu* pdu, mstime when) { struct snmp_value* value; rb_poller* poll = req->poll; @@ -384,7 +384,7 @@ respond_req(rb_request* req, struct snmp_pdu* pdu, uint64_t when) } static int -poller_timer(uint64_t when, void* arg) +poller_timer(mstime when, void* arg) { rb_poller* poll = (rb_poller*)arg; const rb_host* last_host = NULL; @@ -452,9 +452,7 @@ poller_timer(uint64_t when, void* arg) req->interval = (poll->interval <= 2000) ? 200L : 600L; /* Timeout is for the last packet sent, not first */ -fprintf(stderr, "timeout info: %lld %lld %d\n", when, req->interval, g_state.retries); - req->timeout = when + ((uint64_t)req->interval * (uint64_t)g_state.retries) + poll->timeout; -fprintf(stderr, "new request with timeout: %lld %lld %lld\n", poll->timeout, req->timeout, req->interval); + req->timeout = when + (req->interval * ((mstime)g_state.retries)) + poll->timeout; req->sent = 0; last_host = it->host; @@ -541,7 +539,7 @@ receive_resp(int fd, int type, void* arg) } static int -resend_timer(uint64_t when, void* arg) +resend_timer(mstime when, void* arg) { int i; @@ -557,7 +555,7 @@ resend_timer(uint64_t when, void* arg) } static int -prep_timer(uint64_t when, void* arg) +prep_timer(mstime when, void* arg) { /* * We don't prepare all timers at exactly the same time -- cgit v1.2.3