Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
d031ed46bf
  1. 7
      basilisk/basilisk_DEX.c
  2. 12
      basilisk/basilisk_ping.c

7
basilisk/basilisk_DEX.c

@ -185,7 +185,7 @@ struct basilisk_relay *basilisk_request_ensure(struct supernet_info *myinfo,uint
int32_t basilisk_ping_processDEX(struct supernet_info *myinfo,uint32_t senderipbits,uint8_t *data,int32_t datalen) int32_t basilisk_ping_processDEX(struct supernet_info *myinfo,uint32_t senderipbits,uint8_t *data,int32_t datalen)
{ {
int32_t i,len=0; struct basilisk_relay *relay; struct basilisk_request R; uint8_t clen,serialized[256]; uint16_t sn; uint32_t crc; int32_t i,n,len=0; struct basilisk_relay *relay; struct basilisk_request R; uint8_t clen,serialized[256]; uint16_t sn; uint32_t crc;
portable_mutex_lock(&myinfo->DEX_reqmutex); portable_mutex_lock(&myinfo->DEX_reqmutex);
len += iguana_rwnum(0,&data[len],sizeof(sn),&sn); len += iguana_rwnum(0,&data[len],sizeof(sn),&sn);
if ( (relay= basilisk_request_ensure(myinfo,senderipbits,sn)) != 0 ) if ( (relay= basilisk_request_ensure(myinfo,senderipbits,sn)) != 0 )
@ -198,7 +198,10 @@ int32_t basilisk_ping_processDEX(struct supernet_info *myinfo,uint32_t senderipb
if ( relay->numrequests < relay->maxrequests ) if ( relay->numrequests < relay->maxrequests )
{ {
memcpy(serialized,&data[len],clen); memcpy(serialized,&data[len],clen);
len += basilisk_rwDEXquote(0,serialized,&R); n = basilisk_rwDEXquote(0,serialized,&R);
if ( n != clen )
printf("n.%d clen.%d\n",n,clen);
len += clen;
crc = basilisk_requestid(&R); crc = basilisk_requestid(&R);
if ( crc == R.requestid ) if ( crc == R.requestid )
{ {

12
basilisk/basilisk_ping.c

@ -179,9 +179,9 @@ void basilisk_ping_process(struct supernet_info *myinfo,struct iguana_peer *addr
if ( len != datalen ) if ( len != datalen )
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) numrelays.%d numvirts.%d\n",ipbuf,numrelays,numvirts); printf(" <- input ping from.(%s) numrelays.%d datalen.%d\n",ipbuf,numrelays,datalen);
} }
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)
@ -193,9 +193,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->relays[i]); datalen += basilisk_ping_genrelay(myinfo,&data[datalen],maxlen - datalen,&myinfo->relays[i]);
datalen += basilisk_ping_genDEX(myinfo,&data[datalen],maxlen - datalen); datalen += basilisk_ping_genDEX(myinfo,&data[datalen],maxlen - datalen);
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 sn.%d\n",sn); printf(" <- output ping datalen.%d\n",datalen);
return(datalen); return(datalen);
} }

Loading…
Cancel
Save