Show
Ignore:
Timestamp:
02/02/08 23:20:43 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1201994443 +0000
git-parent:

[57a327349609ef60a33dc6da15017c5d6642320a]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1201994443 +0000
Message:

implement staggered start skilz

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/http.c

    r57a3273 ra2e53dc  
    718718} 
    719719static int serf_schedule_next(noit_module_t *self, 
    720                               eventer_t e, noit_check_t *check, 
     720                              struct timeval *last_check, noit_check_t *check, 
    721721                              struct timeval *now) { 
    722722  eventer_t newe; 
    723   struct timeval last_check = { 0L, 0L }; 
    724723  struct timeval period, earliest; 
    725724  serf_closure_t *ccl; 
     
    734733  else 
    735734    gettimeofday(&earliest, NULL); 
    736   if(e) memcpy(&last_check, &e->whence, sizeof(last_check)); 
    737735  period.tv_sec = check->period / 1000; 
    738736  period.tv_usec = (check->period % 1000) * 1000; 
    739737 
    740738  newe = eventer_alloc(); 
    741   memcpy(&newe->whence, &last_check, sizeof(last_check)); 
     739  memcpy(&newe->whence, last_check, sizeof(*last_check)); 
    742740  add_timeval(newe->whence, period, &newe->whence); 
    743741  if(compare_timeval(newe->whence, earliest) < 0) 
     
    757755                              struct timeval *now) { 
    758756  serf_closure_t *cl = (serf_closure_t *)closure; 
    759   serf_schedule_next(cl->self, e, cl->check, now); 
     757  serf_schedule_next(cl->self, &e->whence, cl->check, now); 
    760758  serf_initiate(cl->self, cl->check); 
    761759  free(cl); 
     
    770768  } 
    771769  /* If check->fire_event, we're already scheduled... */ 
    772   if(!check->fire_event) 
    773     serf_schedule_next(self, NULL, check, NULL); 
     770  if(!check->fire_event) { 
     771    struct timeval epoch = { 0L, 0L }; 
     772    noit_check_fake_last_check(check, &epoch, NULL); 
     773    serf_schedule_next(self, &epoch, check, NULL); 
     774  } 
    774775  return 0; 
    775776} 
     
    782783    return 0; 
    783784  } 
    784   if(!check->fire_event) 
    785     serf_schedule_next(self, NULL, check, NULL); 
     785  if(!check->fire_event) { 
     786    struct timeval epoch = { 0L, 0L }; 
     787    noit_check_fake_last_check(check, &epoch, NULL); 
     788    serf_schedule_next(self, &epoch, check, NULL); 
     789  } 
    786790  return 0; 
    787791} 
  • src/modules/ping_icmp.c

    r57a3273 ra2e53dc  
    415415} 
    416416static int ping_icmp_schedule_next(noit_module_t *self, 
    417                                    eventer_t e, noit_check_t *check, 
     417                                   struct timeval *last_check, 
     418                                   noit_check_t *check, 
    418419                                   struct timeval *now) { 
    419420  eventer_t newe; 
    420   struct timeval last_check = { 0L, 0L }; 
    421421  struct timeval period, earliest; 
    422422  struct ping_closure *pcl; 
     
    431431  else 
    432432    gettimeofday(&earliest, NULL); 
    433   if(e) memcpy(&last_check, &e->whence, sizeof(last_check)); 
    434433  period.tv_sec = check->period / 1000; 
    435434  period.tv_usec = (check->period % 1000) * 1000; 
    436435 
    437436  newe = eventer_alloc(); 
    438   memcpy(&newe->whence, &last_check, sizeof(last_check)); 
     437  memcpy(&newe->whence, last_check, sizeof(*last_check)); 
    439438  add_timeval(newe->whence, period, &newe->whence); 
    440439  if(compare_timeval(newe->whence, earliest) < 0) 
     
    454453                                   struct timeval *now) { 
    455454  struct ping_closure *cl = (struct ping_closure *)closure; 
    456   ping_icmp_schedule_next(cl->self, e, cl->check, now); 
     455  ping_icmp_schedule_next(cl->self, &e->whence, cl->check, now); 
    457456  ping_icmp_send(cl->self, cl->check); 
    458457  free(cl); 
     
    466465    return 0; 
    467466  } 
    468   if(!check->fire_event) 
    469     ping_icmp_schedule_next(self, NULL, check, NULL); 
     467  if(!check->fire_event) { 
     468    struct timeval epoch; 
     469    noit_check_fake_last_check(check, &epoch, NULL); 
     470    ping_icmp_schedule_next(self, &epoch, check, NULL); 
     471  } 
    470472  return 0; 
    471473}