jl777 8 years ago
parent
commit
34c8b3060f
  1. 6
      basilisk/basilisk.c
  2. 14
      basilisk/basilisk_ping.c

6
basilisk/basilisk.c

@ -815,7 +815,6 @@ struct basilisk_p2pitem *basilisk_p2pitem_create(struct iguana_info *coin,struct
void basilisk_p2p(struct supernet_info *myinfo,struct iguana_info *coin,struct iguana_peer *addr,char *senderip,uint8_t *data,int32_t datalen,char *type,int32_t encrypted)
{
uint32_t ipbits; int32_t msglen; void *ptr = 0; uint8_t space[4096]; bits256 senderpub;
fprintf(stderr,"P2P ");
ipbits = (uint32_t)calc_ipbits(senderip);
if ( encrypted != 0 )
{
@ -834,7 +833,6 @@ void basilisk_p2p(struct supernet_info *myinfo,struct iguana_info *coin,struct i
else ipbits = myinfo->myaddr.myipbits;
ptr = basilisk_p2pitem_create(coin,addr,type,ipbits,data,datalen);
queue_enqueue("p2pQ",&myinfo->p2pQ,ptr,0);
fprintf(stderr,"p2p\n");
}
void basilisk_requests_poll(struct supernet_info *myinfo)
@ -950,8 +948,8 @@ void basilisks_loop(void *arg)
basilisk_p2pQ_process(myinfo,777);
fprintf(stderr,"\n");
if ( myinfo->NOTARY.RELAYID >= 0 )
endmilli = startmilli + 500;
else endmilli = startmilli + 2500;
endmilli = startmilli + 2500;
else endmilli = startmilli + 5000;
while ( OS_milliseconds() < endmilli )
usleep(10000);
iter++;

14
basilisk/basilisk_ping.c

@ -152,7 +152,7 @@ int32_t basilisk_ping_genMSG(struct supernet_info *myinfo,uint8_t *data,int32_t
datalen += iguana_rwnum(1,&data[datalen],sizeof(msg->duration),&msg->duration);
if ( maxlen > datalen+msg->datalen )
{
//printf("SEND keylen.%d msglen.%d\n",msg->keylen,msg->datalen);
printf("SEND keylen.%d msglen.%d\n",msg->keylen,msg->datalen);
memcpy(&data[datalen],msg->data,msg->datalen), datalen += msg->datalen;
}
else
@ -247,9 +247,9 @@ void basilisk_ping_process(struct supernet_info *myinfo,struct iguana_peer *addr
}
//printf("PING got %d, processed.%d from (%s)\n",datalen,len,ipbuf);
//else printf("\n");
//for (i=0; i<datalen; i++)
// printf("%02x",data[i]);
//printf("<<<<<<<<<<< input ping from.(%s) rel.%d numrelays.%d datalen.%d relay.%d Q.%d\n",ipbuf,basilisk_relayid(myinfo,(uint32_t)calc_ipbits(ipbuf)),numrelays,datalen,myinfo->NOTARY.RELAYID,QUEUEITEMS);
for (i=0; i<datalen; i++)
printf("%02x",data[i]);
printf("<<<<<<<<<<< input ping from.(%s) rel.%d numrelays.%d datalen.%d relay.%d Q.%d\n",ipbuf,basilisk_relayid(myinfo,(uint32_t)calc_ipbits(ipbuf)),numrelays,datalen,myinfo->NOTARY.RELAYID,QUEUEITEMS);
}
int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t maxlen)
@ -261,9 +261,9 @@ int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t max
datalen += basilisk_ping_genrelay(myinfo,&data[datalen],maxlen - datalen,&myinfo->NOTARY.RELAYS[i]);
//datalen += basilisk_ping_genDEX(myinfo,&data[datalen],maxlen - datalen);
datalen += basilisk_ping_genMSG(myinfo,&data[datalen],maxlen - datalen);
//for (i=0; i<datalen; i++)
// printf("%02x",data[i]);
//printf("output ping datalen.%d relay.%d >>>>>>>>>> Q.%d\n",datalen,myinfo->RELAYID,QUEUEITEMS);
for (i=0; i<datalen; i++)
printf("%02x",data[i]);
printf("output ping datalen.%d relay.%d >>>>>>>>>> Q.%d\n",datalen,myinfo->NOTARY.RELAYID,QUEUEITEMS);
return(datalen);
}

Loading…
Cancel
Save