From 6bf88c3764352b85ccc90fa224a8bc1021e0fb92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 22 Sep 2016 08:28:53 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 1 + basilisk/basilisk_MSG.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index f76f831e6..7c6222fe6 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -829,6 +829,7 @@ void basilisk_p2p(struct supernet_info *myinfo,struct iguana_info *coin,struct i ipbits = (uint32_t)calc_ipbits(senderip); else ipbits = myinfo->myaddr.myipbits; ptr = basilisk_p2pitem_create(coin,addr,type,ipbits,data,datalen); + queue_enqueue("p2pQ",&myinfo->p2pQ,ptr,0); } void basilisk_requests_poll(struct supernet_info *myinfo) diff --git a/basilisk/basilisk_MSG.c b/basilisk/basilisk_MSG.c index df6d973db..ffca388ba 100755 --- a/basilisk/basilisk_MSG.c +++ b/basilisk/basilisk_MSG.c @@ -164,7 +164,10 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3 { struct basilisk_message *msg; int32_t i; bits256 desthash; if ( keylen != BASILISK_KEYSIZE ) + { + printf("basilisk_respond_addmessage keylen.%d != %d\n",keylen,BASILISK_KEYSIZE); return(0); + } if ( duration == 0 ) duration = BASILISK_MSGDURATION; else if ( duration > INSTANTDEX_LOCKTIME*2 ) @@ -191,12 +194,12 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3 msg->duration = duration; msg->expiration = (uint32_t)time(NULL) + duration; HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg); + QUEUEITEMS++; } else memcpy(msg->data,data,datalen); + portable_mutex_unlock(&myinfo->messagemutex); for (i=0; iexpiration,msg,msg->hh.next,msg->hh.prev); - QUEUEITEMS++; - portable_mutex_unlock(&myinfo->messagemutex); if ( sendping != 0 ) queue_enqueue("basilisk_message",&myinfo->msgQ,&msg->DL,0); return(clonestr("{\"result\":\"message added to hashtable\"}")); @@ -216,9 +219,9 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha if ( duration > BASILISK_MSGDURATION ) duration = BASILISK_MSGDURATION; } + //char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash)); retstr = basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,1,duration); // printf("OUT keylen.%d datalen.%d\n",keylen,datalen); - //char str[65]; printf("add message.[%d] channel.%u msgid.%x %s\n",datalen,juint(valsobj,"channel"),juint(valsobj,"msgid"),bits256_str(str,hash)); return(retstr); }