debug output changes
This commit is contained in:
@ -282,38 +282,38 @@ int verify_work_destroy(void *handle, void *work_handle) {
|
||||
|
||||
|
||||
|
||||
void cache_insert(verify_container_handle_t *vch, const char *address, int result, const char *output) {
|
||||
void cache_insert(verify_work_handle_t *vwh, const char *address, int result, const char *output) {
|
||||
int mydata_size;
|
||||
mydata_t *mydata;
|
||||
|
||||
if (NULL != vch->cache) {
|
||||
syslog(LOG_DEBUG, "cache_insert: inserting %s -> %d, %s", address, result, output);
|
||||
if (NULL != vwh->vch->cache) {
|
||||
syslog(LOG_DEBUG, "verify (%p) cache_insert: inserting %s -> %d, %s", vwh, address, result, output);
|
||||
mydata_size = (sizeof(mydata_t) + (sizeof(char) * (strlen(output) + 1)));
|
||||
mydata = (mydata_t *) htmalloc(mydata_size);
|
||||
mydata->result = result;
|
||||
strcpy(mydata->output, output);
|
||||
|
||||
htcache_insert(vch->cache, address, (const char*) mydata, mydata_size);
|
||||
htcache_insert(vwh->vch->cache, address, (const char*) mydata, mydata_size);
|
||||
|
||||
free(mydata);
|
||||
}
|
||||
}
|
||||
|
||||
int cache_lookup(verify_container_handle_t *vch, const char* address, int *result, char **output) {
|
||||
int cache_lookup(verify_work_handle_t *vwh, const char* address, int *result, char **output) {
|
||||
mydata_t *mydata;
|
||||
int ret, res = -1;
|
||||
int mydata_size;
|
||||
|
||||
if (NULL != vch->cache) {
|
||||
syslog(LOG_DEBUG, "cache_lookup: Looking up %s", address);
|
||||
ret = htcache_lookup(vch->cache, address, (char**) &mydata, &mydata_size);
|
||||
if (NULL != vwh->vch->cache) {
|
||||
syslog(LOG_DEBUG, "verify (%p) cache_lookup: Looking up %s", vwh, address);
|
||||
ret = htcache_lookup(vwh->vch->cache, address, (char**) &mydata, &mydata_size);
|
||||
if (0 == ret) {
|
||||
*result = mydata->result;
|
||||
*output = (char*) htmalloc(sizeof(char) * (strlen(mydata->output) + 1));
|
||||
strcpy(*output, mydata->output);
|
||||
res = 0;
|
||||
free(mydata);
|
||||
syslog(LOG_DEBUG, "cache_lookup: found %d %s", *result, *output);
|
||||
syslog(LOG_DEBUG, "verify (%p) cache_lookup: found %d %s", vwh, *result, *output);
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ static void *worker_thread(void *arg) {
|
||||
wt->output = (char*) NOT_AN_ADDRESS;
|
||||
result = SMM_LOCAL_PERM_NOK;
|
||||
} else {
|
||||
if (0 == cache_lookup(wt->vwh->vch, wt->input, &result, &cached_output)) {
|
||||
if (0 == cache_lookup(wt->vwh, wt->input, &result, &cached_output)) {
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: got a cached result for %s -> %d, %s",
|
||||
wt->vwh, wt->input, result, cached_output);
|
||||
incStatCounter(STAT_CNT_VERIFIER_ANSWERED_FROM_CACHE);
|
||||
@ -676,7 +676,7 @@ static void *worker_thread(void *arg) {
|
||||
syslog(LOG_DEBUG, "verify (%p) worker_thread: this is a permanent result, returning", wt->vwh);
|
||||
wt->output = ct->output;
|
||||
result = ct->result;
|
||||
cache_insert(wt->vwh->vch, wt->input, ct->result, ct->output);
|
||||
cache_insert(wt->vwh, wt->input, ct->result, ct->output);
|
||||
/* ct will be freed later, since its output is needed below */
|
||||
break; /* exit from the ct-collecting while loop, leave the rest of the ct's
|
||||
for the cleanup */
|
||||
|
Reference in New Issue
Block a user