Browse Source

test

etomic
jl777 8 years ago
parent
commit
f2eb40c697
  1. 4
      basilisk/basilisk_DEX.c
  2. 17
      basilisk/basilisk_MSG.c
  3. 9
      iguana/dpow/dpow_network.c

4
basilisk/basilisk_DEX.c

@ -178,7 +178,7 @@ cJSON *basilisk_requestjson(struct basilisk_request *rp)
{
for (i=0; i<sizeof(*rp); i++)
printf("%02x",((uint8_t *)rp)[i]);
printf(" <- rp\n");
printf(" <- rp.%p\n",rp);
for (i=0; i<sizeof(R); i++)
printf("%02x",((uint8_t *)&R)[i]);
printf(" <- R mismatch\n");
@ -292,9 +292,9 @@ void basilisk_requests_poll(struct supernet_info *myinfo)
free(retstr);*/
if ( bits256_cmp(myinfo->myaddr.persistent,issueR.srchash) == 0 ) // my request
{
printf("my req hwm %f\n",hwm);
if ( (retstr= InstantDEX_accept(myinfo,0,0,0,issueR.requestid,issueR.quoteid)) != 0 )
free(retstr);
printf("my req hwm %f -> %u\n",hwm,issueR.requestid);
basilisk_channelsend(myinfo,issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),60);
numiters = 0;
while ( numiters < 10 && (crc= basilisk_crcsend(myinfo,0,buf,sizeof(buf),issueR.srchash,issueR.desthash,channel,0x4000000,(void *)&issueR.requestid,sizeof(issueR.requestid),crcs)) == 0 )

17
basilisk/basilisk_MSG.c

@ -216,17 +216,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
msg->expiration = (uint32_t)time(NULL) + duration;
HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg);
QUEUEITEMS++;
{
struct basilisk_request R;
/*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]);*/
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);
}
portable_mutex_unlock(&myinfo->messagemutex);
//if ( myinfo->NOTARY.RELAYID >= 0 )
// dpow_handler(myinfo,msg);
@ -315,12 +304,10 @@ HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)
} //else printf("not notary.%d relayid.%d\n",myinfo->IAMNOTARY,myinfo->NOTARY.RELAYID);
if ( vals != 0 && juint(vals,"fanout") == 0 )
jaddnum(vals,"fanout",MAX(8,(int32_t)sqrt(myinfo->NOTARY.NUMRELAYS)+2));
memcpy(space2,key,BASILISK_KEYSIZE);
if ( data != 0 && datalen != 0 )
{
memcpy(space2,key,BASILISK_KEYSIZE);
memcpy(&space2[BASILISK_KEYSIZE],data,datalen);
dex_reqsend(myinfo,"DEX",space2,datalen+BASILISK_KEYSIZE);
}
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"

9
iguana/dpow/dpow_network.c

@ -125,14 +125,14 @@ int32_t dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int
memcpy(dexp->packet,data,datalen);
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<datalen; i++)
printf("%02x",((uint8_t *)data)[i]);
printf(" sent.%d:%d datalen.%d\n",sentbytes,size,datalen);
if ( (recvbytes= nn_recv(myinfo->reqsock,&retptr,NN_MSG,0)) >= 0 )
{
ipbits = *retptr;
expand_ipbits(ipaddr,ipbits);
printf("req returned.[%d] %08x %s\n",recvbytes,*retptr,ipaddr);
//printf("req returned.[%d] %08x %s\n",recvbytes,*retptr,ipaddr);
portable_mutex_lock(&myinfo->dexmutex);
n = myinfo->numdexipbits;
for (i=0; i<n; i++)
@ -206,6 +206,7 @@ int32_t dex_subsock_poll(struct supernet_info *myinfo)
int32_t size= -1; struct dex_nanomsghdr *dexp;
if ( myinfo->subsock >= 0 && (size= nn_recv(myinfo->subsock,&dexp,NN_MSG,0)) >= 0 )
{
printf("SUBSOCK.%08x recv.%d datalen.%d\n",dexp->crc32,size,dexp->datalen);
if ( dex_packetcheck(myinfo,dexp,size) == 0 )
{
printf("SUBSOCK.%08x ",dexp->crc32);

Loading…
Cancel
Save