active probe

git-svn-id: file:///svn/unbound/trunk@1802 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards
2009-09-01 14:47:57 +00:00
parent 0a35d358ee
commit 415236c002
11 changed files with 107 additions and 12 deletions
+12 -2
View File
@@ -460,11 +460,21 @@ static void
time_passes(struct replay_runtime* runtime, struct replay_moment* mom)
{
struct fake_timer *t;
timeval_add(&runtime->now_tv, &mom->elapse);
struct timeval tv = mom->elapse;
if(mom->string) {
char* xp = macro_process(runtime->vars, runtime, mom->string);
double sec;
if(!xp) fatal_exit("could not macro expand %s", mom->string);
verbose(VERB_ALGO, "EVAL %s", mom->string);
sec = atof(xp);
tv.tv_sec = (int)sec;
tv.tv_usec = (int)((sec - (double)tv.tv_sec) *1000000. + 0.5);
}
timeval_add(&runtime->now_tv, &tv);
runtime->now_secs = (uint32_t)runtime->now_tv.tv_sec;
#ifndef S_SPLINT_S
log_info("elapsed %d.%6.6d now %d.%6.6d",
(int)mom->elapse.tv_sec, (int)mom->elapse.tv_usec,
(int)tv.tv_sec, (int)tv.tv_usec,
(int)runtime->now_tv.tv_sec, (int)runtime->now_tv.tv_usec);
#endif
/* see if any timers have fired; and run them */
+10
View File
@@ -301,6 +301,16 @@ replay_moment_read(char* remain, FILE* in, const char* name, int* lineno,
mom->evt_type = repevt_timeout;
} else if(parse_keyword(&remain, "TIME_PASSES")) {
mom->evt_type = repevt_time_passes;
while(isspace((int)*remain))
remain++;
if(parse_keyword(&remain, "EVAL")) {
while(isspace((int)*remain))
remain++;
mom->string = strdup(remain);
if(!mom->string) fatal_exit("out of memory");
mom->string[strlen(mom->string)-1]=0;
remain += strlen(mom->string);
}
} else if(parse_keyword(&remain, "CHECK_AUTOTRUST")) {
mom->evt_type = repevt_autotrust_check;
while(isspace((int)*remain))
+1
View File
@@ -69,6 +69,7 @@
* o TIMEOUT
* o TIME_PASSES ELAPSE [seconds] - increase 'now' time counter, can be
* a floating point number.
* TIME_PASSES EVAL [macro] - expanded for seconds to move time.
* o CHECK_AUTOTRUST [id] - followed by FILE_BEGIN [to match] FILE_END.
* The file contents is macro expanded before match.
* o ERROR