jl777 8 years ago
parent
commit
bf84f287cc
  1. 14
      basilisk/basilisk.c

14
basilisk/basilisk.c

@ -375,7 +375,7 @@ struct basilisk_item *basilisk_issueremote(struct supernet_info *myinfo,struct i
if ( (retarray= pending->retarray) != 0 ) if ( (retarray= pending->retarray) != 0 )
{ {
pending->retstr = jprint(retarray,0); pending->retstr = jprint(retarray,0);
//printf("num.%d:%d required.%d RETSTR.(%s)\n",pending->numresults,cJSON_GetArraySize(pending->retarray),pending->numrequired,pending->retstr); printf("num.%d:%d required.%d RETSTR.(%s)\n",pending->numresults,cJSON_GetArraySize(pending->retarray),pending->numrequired,pending->retstr);
pending->retarray = 0; pending->retarray = 0;
free_json(retarray); free_json(retarray);
} }
@ -401,8 +401,8 @@ struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,struc
if ( (timeoutmillis= jint(valsobj,"timeout")) == 0 ) if ( (timeoutmillis= jint(valsobj,"timeout")) == 0 )
timeoutmillis = BASILISK_TIMEOUT; timeoutmillis = BASILISK_TIMEOUT;
minfanout = sqrt(myinfo->NOTARY.NUMRELAYS)+1; minfanout = sqrt(myinfo->NOTARY.NUMRELAYS)+1;
if ( minfanout < 5 ) if ( minfanout < 8 )
minfanout = 5; minfanout = 8;
if ( jobj(valsobj,"fanout") == 0 ) if ( jobj(valsobj,"fanout") == 0 )
fanout = minfanout; fanout = minfanout;
else fanout = jint(valsobj,"fanout"); else fanout = jint(valsobj,"fanout");
@ -447,15 +447,15 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,void *_add
if ( ptr->numsent > 0 ) if ( ptr->numsent > 0 )
{ {
//queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0); //queue_enqueue("submitQ",&myinfo->basilisks.submitQ,&ptr->DL,0);
jaddstr(retjson,"result","success"); jaddstr(retjson,"result","error");
jaddnum(retjson,"numsent",ptr->numsent); jaddnum(retjson,"numsent",ptr->numsent);
} else jaddstr(retjson,"error","didnt find any nodes to send to"); } else jaddstr(retjson,"error","didnt find any nodes to send to");
retstr = jprint(retjson,1); retstr = jprint(retjson,1);
} }
ptr->finished = (uint32_t)time(NULL); ptr->finished = (uint32_t)time(NULL);
} }
if ( strcmp("MSG",CMD) == 0 ) //if ( strcmp("MSG",CMD) == 0 )
printf("%s.(%s) -> (%s)\n",CMD,jprint(valsobj,0),retstr!=0?retstr:""); // printf("%s.(%s) -> (%s)\n",CMD,jprint(valsobj,0),retstr!=0?retstr:"");
return(retstr); return(retstr);
} }
@ -600,7 +600,7 @@ void basilisk_result(struct supernet_info *myinfo,char *remoteaddr,uint32_t basi
jaddi(pending->retarray,item); jaddi(pending->retarray,item);
if ( jobj(item,"error") == 0 ) if ( jobj(item,"error") == 0 )
{ {
//printf("numresults.%d:%d\n",pending->numresults,cJSON_GetArraySize(pending->retarray)); printf("numresults.%d:%d\n",pending->numresults,cJSON_GetArraySize(pending->retarray));
pending->numresults++; pending->numresults++;
} }
} else printf("couldnt parse.(%s)\n",retstr); } else printf("couldnt parse.(%s)\n",retstr);

Loading…
Cancel
Save