Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ae24d9d5ba
  1. 6
      basilisk/basilisk.c
  2. 8
      basilisk/basilisk_ping.c

6
basilisk/basilisk.c

@ -625,7 +625,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
{ {
if ( basilisk_specialcmd(CMD) == 0 ) if ( basilisk_specialcmd(CMD) == 0 )
return; return;
printf("MSGPROCESS %s.(%s) tag.%d\n",CMD,(char *)data,basilisktag); //printf("MSGPROCESS %s.(%s) tag.%d\n",CMD,(char *)data,basilisktag);
} }
symbol = "BTCD"; symbol = "BTCD";
if ( senderipbits == 0 ) if ( senderipbits == 0 )
@ -744,7 +744,7 @@ void basilisk_p2p(void *_myinfo,void *_addr,char *senderip,uint8_t *data,int32_t
len += iguana_rwnum(0,data,sizeof(basilisktag),&basilisktag); len += iguana_rwnum(0,data,sizeof(basilisktag),&basilisktag);
//int32_t i; for (i=0; i<datalen-len; i++) //int32_t i; for (i=0; i<datalen-len; i++)
// printf("%02x",data[len+i]); // printf("%02x",data[len+i]);
if ( myinfo->RELAYID >= 0 ) if ( 0 && myinfo->RELAYID >= 0 )
printf(" ->received.%d basilisk_p2p.(%s) from %s tag.%d\n",datalen,type,senderip!=0?senderip:"?",basilisktag); printf(" ->received.%d basilisk_p2p.(%s) from %s tag.%d\n",datalen,type,senderip!=0?senderip:"?",basilisktag);
basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len); basilisk_msgprocess(myinfo,_addr,ipbits,type,basilisktag,&data[len],datalen - len);
} }
@ -887,7 +887,7 @@ HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr)
coin = iguana_coinfind(symbol); coin = iguana_coinfind(symbol);
} }
if ( jobj(vals,"fanout") == 0 ) if ( jobj(vals,"fanout") == 0 )
jaddnum(vals,"fanout",8); jaddnum(vals,"fanout",(int32_t)sqrt(myinfo->numrelays));
if ( jobj(vals,"numrequired") == 0 ) if ( jobj(vals,"numrequired") == 0 )
jaddnum(vals,"numrequired",myinfo->numrelays); jaddnum(vals,"numrequired",myinfo->numrelays);
if ( coin != 0 ) if ( coin != 0 )

8
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); datalen += iguana_rwnum(1,&data[datalen],sizeof(msg->duration),&msg->duration);
if ( maxlen > datalen+msg->datalen ) 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; memcpy(&data[datalen],msg->data,msg->datalen), datalen += msg->datalen;
} }
else else
@ -242,12 +242,12 @@ void basilisk_ping_process(struct supernet_info *myinfo,struct iguana_peer *addr
//len += basilisk_ping_processDEX(myinfo,senderipbits,&data[len],datalen-len); //len += basilisk_ping_processDEX(myinfo,senderipbits,&data[len],datalen-len);
len += basilisk_ping_processMSG(myinfo,senderipbits,&data[len],datalen-len); len += basilisk_ping_processMSG(myinfo,senderipbits,&data[len],datalen-len);
} }
if ( len != datalen ) if ( len != datalen+1 )
printf("PING got %d, processed.%d from (%s)\n",datalen,len,ipbuf); printf("PING got %d, processed.%d from (%s)\n",datalen,len,ipbuf);
//else printf("\n"); //else printf("\n");
//for (i=0; i<datalen; i++) //for (i=0; i<datalen; i++)
// printf("%02x",data[i]); // printf("%02x",data[i]);
printf(" <- input ping from.(%s) rel.%d numrelays.%d datalen.%d relay.%d\n",ipbuf,basilisk_relayid(myinfo,(uint32_t)calc_ipbits(ipbuf)),numrelays,datalen,myinfo->RELAYID); 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->RELAYID,QUEUEITEMS);
} }
int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t maxlen) int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t maxlen)
@ -261,7 +261,7 @@ int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t max
datalen += basilisk_ping_genMSG(myinfo,&data[datalen],maxlen - datalen); datalen += basilisk_ping_genMSG(myinfo,&data[datalen],maxlen - datalen);
//for (i=0; i<datalen; i++) //for (i=0; i<datalen; i++)
// printf("%02x",data[i]); // printf("%02x",data[i]);
printf(" <- output ping datalen.%d relay.%d Q.%d\n",datalen,myinfo->RELAYID,QUEUEITEMS); printf("output ping datalen.%d relay.%d >>>>>>>>>> Q.%d\n",datalen,myinfo->RELAYID,QUEUEITEMS);
return(datalen); return(datalen);
} }

Loading…
Cancel
Save