diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index f3f727045..43990d577 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -744,7 +744,8 @@ void basilisks_loop(void *arg) //for (i=0; iRELAYNODE == 0 && coin->VALIDATENODE == 0 && coin->active != 0 && coin->chain->userpass[0] != 0 && coin->MAXPEERS == 1 ) // basilisk_bitcoinscan(coin,blockspace,&RAWMEM); - basilisk_requests_poll(myinfo); + if ( (rand() % 10) == 0 ) + basilisk_requests_poll(myinfo); now = (uint32_t)time(NULL); portable_mutex_lock(&myinfo->messagemutex); HASH_ITER(hh,myinfo->messagetable,msg,tmpmsg) diff --git a/basilisk/basilisk_DEX.c b/basilisk/basilisk_DEX.c index 92ab67d5d..e97c4d2cd 100755 --- a/basilisk/basilisk_DEX.c +++ b/basilisk/basilisk_DEX.c @@ -327,7 +327,7 @@ char *basilisk_respond_requests(struct supernet_info *myinfo,bits256 hash,uint32 for (i=0; irequestid == requestid && (quoteid == 0 || quoteid == rp->quoteid) && (bits256_cmp(hash,rp->hash) == 0 || bits256_cmp(hash,rp->desthash) == 0) ) + if ( (requestid == 0 || rp->requestid == requestid) && (quoteid == 0 || quoteid == rp->quoteid) && (bits256_cmp(hash,rp->hash) == 0 || bits256_cmp(hash,rp->desthash) == 0) ) jaddi(array,basilisk_requestjson(rp->relaybits,rp)); } } diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index 15fbc5c92..517fac8f9 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -38,12 +38,18 @@ int32_t basilisk_ping_processMSG(struct supernet_info *myinfo,uint32_t senderipb int32_t i,msglen,len=0; uint8_t num,keylen,*msg,*key; if ( (num= data[len++]) > 0 ) { + printf("processMSG num.%d datalen.%d\n",num,datalen); for (i=0; i datalen ) + return(0); len += iguana_rwnum(0,&data[len],sizeof(msglen),&msglen); msg = &data[len], len += msglen; + if ( msglen <= 0 || len > datalen ) + return(0); + printf("i.%d: keylen.%d msglen.%d\n",i,keylen,msglen); basilisk_respond_sendmessage(myinfo,key,keylen,msg,msglen,0); } } @@ -60,7 +66,10 @@ int32_t basilisk_ping_genMSG(struct supernet_info *myinfo,uint8_t *data,int32_t memcpy(&data[datalen],msg->key,msg->keylen), datalen += msg->keylen; iguana_rwnum(1,data,sizeof(msg->datalen),&msg->datalen); if ( maxlen > datalen+msg->datalen ) + { + printf("SEND keylen.%d msglen.%d\n",msg->keylen,msg->datalen); memcpy(&data[datalen],msg->data,msg->datalen), datalen += msg->datalen; + } else { printf("basilisk_ping_genMSG message doesnt fit %d vs %d\n",maxlen,datalen+msg->datalen); @@ -103,6 +112,7 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha { int32_t keylen; uint8_t key[64]; keylen = basilisk_messagekey(key,hash,valsobj); + printf("keylen.%d datalen.%d\n",keylen,datalen); return(basilisk_respond_sendmessage(myinfo,key,keylen,data,datalen,1)); } diff --git a/iguana/tests/send b/iguana/tests/send new file mode 100755 index 000000000..309e1f3e1 --- /dev/null +++ b/iguana/tests/send @@ -0,0 +1 @@ +curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"sendmessage\",\"vals\":{\"channel\":12345,\"msgid\":1},\"hexstr\":\"deadbeef\"}"