Browse Source

test

etomic
jl777 8 years ago
parent
commit
8442c6a7f5
  1. 4
      basilisk/basilisk_DEX.c
  2. 14
      basilisk/basilisk_MSG.c
  3. 12
      iguana/dpow/dpow_network.c

4
basilisk/basilisk_DEX.c

@ -117,9 +117,9 @@ int32_t basilisk_rwDEXquote(int32_t rwflag,uint8_t *serialized,struct basilisk_r
memcpy(rp->dest,&serialized[len],sizeof(rp->dest)), len += sizeof(rp->dest);
}
if ( rp->quoteid != 0 && basilisk_quoteid(rp) != rp->quoteid )
printf("basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u\n",rwflag,rp->quoteid,basilisk_quoteid(rp));
printf(" basilisk_rwDEXquote.%d: quoteid.%u mismatch calc %u\n",rwflag,rp->quoteid,basilisk_quoteid(rp));
if ( basilisk_requestid(rp) != rp->requestid )
printf("basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u\n",rwflag,rp->requestid,basilisk_requestid(rp));
printf(" basilisk_rwDEXquote.%d: requestid.%u mismatch calc %u\n",rwflag,rp->requestid,basilisk_requestid(rp));
return(len);
}

14
basilisk/basilisk_MSG.c

@ -218,11 +218,11 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
QUEUEITEMS++;
{
struct basilisk_request R;
int32_t i; for (i=0; i<BASILISK_KEYSIZE; i++)
/*int32_t i; for (i=0; i<BASILISK_KEYSIZE; i++)
printf("%02x",key[i]);
printf(" key, ");
for (i=0; i<datalen; i++)
printf("%02x",data[i]);
printf("%02x",data[i]);*/
basilisk_rwDEXquote(0,data,&R);
printf(" %s <- ADDMSG.[%d] exp %u %p (%p %p)\n",jprint(basilisk_requestjson(&R),1),QUEUEITEMS,msg->expiration,msg,msg->hh.next,msg->hh.prev);
}
@ -298,12 +298,11 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
{
int32_t keylen,datalen; uint8_t key[BASILISK_KEYSIZE],space[16384],*data,*ptr = 0; char *retstr=0;
int32_t keylen,datalen; uint8_t key[BASILISK_KEYSIZE],space[16384],space2[16384],*data,*ptr = 0; char *retstr=0;
data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,&space[BASILISK_KEYSIZE],sizeof(space)-BASILISK_KEYSIZE,hexstr);
if ( myinfo->dexsock >= 0 || (myinfo->IAMNOTARY != 0 && myinfo->NOTARY.RELAYID >= 0) )
{
keylen = basilisk_messagekey(key,juint(vals,"channel"),juint(vals,"msgid"),jbits256(vals,"srchash"),jbits256(vals,"desthash"));
memcpy(space,key,BASILISK_KEYSIZE);
if ( data != 0 )
{
retstr = basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,0,juint(vals,"duration"));
@ -316,7 +315,11 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
if ( vals != 0 && juint(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2));
if ( data != 0 && datalen != 0 )
dex_reqsend(myinfo,"DEX",space,datalen+BASILISK_KEYSIZE);
{
memcpy(space2,key,BASILISK_KEYSIZE);
memcpy(&space2[BASILISK_KEYSIZE],data,datalen);
dex_reqsend(myinfo,"DEX",space2,datalen+BASILISK_KEYSIZE);
}
return(basilisk_standardservice("OUT",myinfo,0,jbits256(vals,"desthash"),vals,hexstr,0));
}
#include "../includes/iguana_apiundefs.h"
@ -524,7 +527,6 @@ uint32_t basilisk_crcrecv(struct supernet_info *myinfo,int32_t width,uint8_t *ve
} else printf("not keystr.%p or no data.%p or bad datalen.%d\n",keystr,hexstr,datalen);
}
}
printf("(%s).%d ",jprint(item,0),i);
}
//printf("n.%d maxlen.%d\n",n,maxlen);
}

12
iguana/dpow/dpow_network.c

@ -60,7 +60,7 @@ void dex_packet(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp,int32_t
char *retstr; int32_t i;
for (i=0; i<size; i++)
printf("%02x",((uint8_t *)dexp)[i]);
printf(" uniq DEX_PACKET.[%d] crc.%x lag.%d (%d %d)\n",size,calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32))),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen);
printf(" uniq DEX_PACKET.[%d] crc.%x lag.%d (%d %d)\n",size,calc_crc32(0,dexp->packet,dexp->datalen),(int32_t)(time(NULL)-dexp->timestamp),dexp->size,dexp->datalen);
if ( dexp->datalen > BASILISK_KEYSIZE )
{
if ( (retstr= basilisk_respond_addmessage(myinfo,dexp->packet,BASILISK_KEYSIZE,&dexp->packet[BASILISK_KEYSIZE],dexp->datalen-BASILISK_KEYSIZE,0,BASILISK_DEXDURATION)) != 0 )
@ -123,11 +123,11 @@ int32_t dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int
dexp->version0 = DEX_VERSION & 0xff;
dexp->version1 = (DEX_VERSION >> 8) & 0xff;
memcpy(dexp->packet,data,datalen);
dexp->crc32 = calc_crc32(0,(void *)((long)dexp+sizeof(dexp->crc32)),(int32_t)(size-sizeof(dexp->crc32)));
dexp->crc32 = calc_crc32(0,data,datalen);
sentbytes = nn_send(myinfo->reqsock,dexp,size,0);
for (i=0; i<size; i++)
printf("%02x",((uint8_t *)dexp)[i]);
printf(" sent.%d:%d\n",sentbytes,size);
//for (i=0; i<size; i++)
// printf("%02x",((uint8_t *)dexp)[i]);
//printf(" sent.%d:%d\n",sentbytes,size);
if ( (recvbytes= nn_recv(myinfo->reqsock,&retptr,NN_MSG,0)) >= 0 )
{
ipbits = *retptr;
@ -193,7 +193,7 @@ int32_t dex_packetcheck(struct supernet_info *myinfo,struct dex_nanomsghdr *dexp
{
if ( dexp->datalen == (size - sizeof(*dexp)) )
{
crc32 = calc_crc32(0,(void *)((long)dexp + sizeof(dexp->crc32)),(int32_t)(size - sizeof(dexp->crc32)));
crc32 = calc_crc32(0,dexp->packet,dexp->datalen);//(void *)((long)dexp + sizeof(dexp->crc32)),(int32_t)(size - sizeof(dexp->crc32)));
if ( dexp->crc32 == crc32 && (firstz= dex_crc32find(myinfo,crc32)) >= 0 )
return(0);
}

Loading…
Cancel
Save