Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
094b31076a
  1. 4
      iguana/iguana_peers.c
  2. 11
      iguana/main.c

4
iguana/iguana_peers.c

@ -742,7 +742,7 @@ int32_t iguana_pollsendQ(struct iguana_info *coin,struct iguana_peer *addr)
printf("unexpected getdata for %s\n",addr->ipaddr);
myfree(packet,sizeof(*packet) + packet->datalen);
}
else if ( packet->embargo.x == 0 || tai_diff(packet->embargo,tai_now()) < 0 )
else if ( packet->embargo.x == 0 || tai_diff(packet->embargo,tai_now()) >= -SMALLVAL )
{
iguana_send(coin,addr,packet->serialized,packet->datalen);
myfree(packet,sizeof(*packet) + packet->datalen);
@ -750,7 +750,7 @@ int32_t iguana_pollsendQ(struct iguana_info *coin,struct iguana_peer *addr)
}
else
{
printf("embargo.x %f\n",tai_diff(packet->embargo,tai_now()));
printf("embargo.x %llu %f\n",(long long)packet->embargo.x,tai_diff(packet->embargo,tai_now()));
queue_enqueue("embargo",&addr->sendQ,&packet->DL,0);
}
}

11
iguana/main.c

@ -74,7 +74,7 @@ int32_t iguana_jsonQ()
printf("process.(%s)\n",ptr->jsonstr);
if ( (*ptr->retjsonstrp= SuperNET_jsonstr(ptr->myinfo,ptr->jsonstr,ptr->remoteaddr)) == 0 )
*ptr->retjsonstrp = clonestr("{\"error\":\"null return from iguana_jsonstr\"}");
printf("finished.(%s)\n",ptr->jsonstr);
printf("finished.(%s) -> (%s)\n",ptr->jsonstr,*ptr->retjsonstrp!=0?*ptr->retjsonstrp:"null return");
queue_enqueue("finishedQ",&finishedQ,&ptr->DL,0);
return(1);
}
@ -162,6 +162,7 @@ char *iguana_JSON(char *jsonstr)
char *SuperNET_p2p(struct iguana_info *coin,int32_t *delaymillisp,char *ipaddr,uint8_t *data,int32_t datalen)
{
cJSON *json,*retjson; char *agent,*method,*retstr = 0;
*delaymillisp = 0;
if ( (json= cJSON_Parse((char *)data)) != 0 )
{
printf("GOT >>>>>>>> SUPERNET P2P.(%s) from.%s\n",(char *)data,coin->symbol);
@ -170,18 +171,18 @@ char *SuperNET_p2p(struct iguana_info *coin,int32_t *delaymillisp,char *ipaddr,u
jaddstr(json,"fromp2p",coin->symbol);
if ( (retstr= SuperNET_JSON(0,json,ipaddr)) != 0 )
{
printf("retstr.(%s)\n",retstr);
//printf("retstr.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( jobj(retjson,"result") != 0 || jobj(retjson,"error") != 0 || jobj(retjson,"method") == 0 )
{
printf("it is a result, dont return\n");
//printf("it is a result, dont return\n");
free(retstr);
retstr = 0;
}
} else *delaymillisp = (rand() % 1000);
free_json(retjson);
}
}
} else printf("null retstr from SuperNET_JSON\n");
}
free_json(json);
}

Loading…
Cancel
Save