Skip to content

Commit

Permalink
Bugfix for choose parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksheeep committed May 15, 2014
1 parent a805041 commit 17ba033
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions krivine.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,10 @@ ZAM_term(struct ccnl_relay_s *ccnl, struct configuration_s *config,
return strdup(dummybuf);
}
if(!strncmp(prog, "OP_FOX", 6)){
int local_search = 0;
if(*restart) {
*restart = 0;
local_search = 1;
goto recontinue;
}
DEBUGMSG(2, "---to do: OP_FOX <%s>\n", prog+7);
Expand All @@ -744,18 +746,20 @@ ZAM_term(struct ccnl_relay_s *ccnl, struct configuration_s *config,
}
//as long as there is a routable parameter: try to find a result
config->fox_state->it_routable_param = 0;
int parameter_number = -1;
int parameter_number = 0;
struct ccnl_content_s *c = NULL;

recontinue:
//check if last result is now available
parameter_number = choose_parameter(config);
unsigned char *namecomp[CCNL_MAX_NAME_COMP];
int compcnt = splitComponents(strdup(config->fox_state->params[parameter_number]), namecomp);
compcnt =create_namecomps(ccnl, config, parameter_number, thunk_request, compcnt, namecomp);
c = ccnl_nfn_local_content_search(ccnl, namecomp, compcnt); //search for a result
if(c) goto handlecontent;

int compcnt = 0;
recontinue:
if(local_search){
parameter_number = choose_parameter(config);
compcnt = splitComponents(strdup(config->fox_state->params[parameter_number]), namecomp);
compcnt =create_namecomps(ccnl, config, parameter_number, thunk_request, compcnt, namecomp);
c = ccnl_nfn_local_content_search(ccnl, namecomp, compcnt); //search for a result
if(c) goto handlecontent;
}
//result was not delivered --> choose next parameter
++config->fox_state->it_routable_param;
parameter_number = choose_parameter(config);
Expand Down

0 comments on commit 17ba033

Please sign in to comment.