diff options
| author | Stef Walter <stef@memberwebs.com> | 2006-01-28 21:52:02 +0000 | 
|---|---|---|
| committer | Stef Walter <stef@memberwebs.com> | 2006-01-28 21:52:02 +0000 | 
| commit | 2f68afaa50abf604c101b7c9c0b4ebfeb2b5d57a (patch) | |
| tree | c97fee1a838be5d74a60b8f8a7a60c4242c25142 | |
| parent | df69b00d717b3a4c6c0c8b9a968516c444d2664c (diff) | |
Fix resends.
| -rw-r--r-- | common/server-mainloop.c | 4 | ||||
| -rw-r--r-- | daemon/snmp-engine.c | 12 | 
2 files changed, 9 insertions, 7 deletions
| diff --git a/common/server-mainloop.c b/common/server-mainloop.c index 6ea8985..9eefb6f 100644 --- a/common/server-mainloop.c +++ b/common/server-mainloop.c @@ -98,7 +98,7 @@ timeval_compare(struct timeval* t1, struct timeval* t2)      ((((uint64_t)(tv).tv_sec) * 1000L) + (((uint64_t)(tv).tv_usec) / 1000L))  #define timeval_dump(tv) \ -    (fprintf(stderr, "{ %d:%d }", (uint)((tv)->tv_sec), (uint)((tv)->tv_usec / 1000)) +    (fprintf(stderr, "{ %d:%d }", (uint)((tv).tv_sec), (uint)((tv).tv_usec / 1000)))  static int  add_timer(int ms, int oneshot, server_timer_callback callback, void* arg) @@ -278,7 +278,7 @@ server_run()              }              /* Get soonest timer */ -            if (!timeout || timeval_compare(timeout, &timcb->at) < 0) +            if (!timeout || timeval_compare(&timcb->at, timeout) < 0)                  timeout = &timcb->at;              timcb = timcb->next; diff --git a/daemon/snmp-engine.c b/daemon/snmp-engine.c index 24274b8..972ebf1 100644 --- a/daemon/snmp-engine.c +++ b/daemon/snmp-engine.c @@ -278,6 +278,8 @@ send_req(rb_request* req, mstime when)      req->sent++;      if(req->sent <= g_state.retries)          req->next_retry = when + req->interval; +    else +        req->next_retry = 0;  }  static void @@ -387,7 +389,7 @@ respond_req(rb_request* req, struct snmp_pdu* pdu, mstime when)                  if(msg)                      rb_messagex(LOG_WARNING, msg, item->rrdfield);                  else if(item->vtype == VALUE_REAL) -                    rb_messagex(LOG_DEBUG, "got value for field '%s': %lld", +                    rb_messagex(LOG_DEBUG, "got value for field '%s': %.4lf",                                  item->rrdfield, item->v.i_value);                  else if(item->vtype == VALUE_FLOAT)                      rb_messagex(LOG_DEBUG, "got value for field '%s': %lld", @@ -590,11 +592,11 @@ receive_resp(int fd, int type, void* arg)  static int  resend_timer(mstime when, void* arg)  { -    int i; +    int i, first; -    /* Search forwards through the scrolling window */ -    for(i = (reqlow + 1) % nrequests; i != reqhigh; -        i = (i + 1) % nrequests) +    /* Search backwards through the scrolling window */ +    for(i = reqhigh, first = 1; first || i != reqlow; +        i = (i ? i : nrequests) - 1, first = 0)      {          if(requests[i].id)              check_req(&(requests[i]), when); | 
