jl777 8 years ago
parent
commit
975f81f2f9
  1. 24
      basilisk/basilisk_MSG.c

24
basilisk/basilisk_MSG.c

@ -91,11 +91,11 @@ char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_
width = 3600; width = 3600;
else if ( width < 1 ) else if ( width < 1 )
width = 1; width = 1;
allflag = (bits256_nonz(srchash) == 0 && bits256_nonz(desthash) == 0); allflag = 0;//(bits256_nonz(srchash) == 0 && bits256_nonz(desthash) == 0);
array = cJSON_CreateArray(); array = cJSON_CreateArray();
fprintf(stderr,"{"); fprintf(stderr,"{");
portable_mutex_lock(&myinfo->messagemutex); portable_mutex_lock(&myinfo->messagemutex);
HASH_ITER(hh,myinfo->messagetable,msg,tmpmsg) /*HASH_ITER(hh,myinfo->messagetable,msg,tmpmsg)
{ {
if ( allflag != 0 || (msg->broadcast != 0 && basilisk_msgcmp(msg,origwidth,channel,msgid,zero,zero) == 0) ) if ( allflag != 0 || (msg->broadcast != 0 && basilisk_msgcmp(msg,origwidth,channel,msgid,zero,zero) == 0) )
{ {
@ -109,7 +109,7 @@ char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_
QUEUEITEMS--; QUEUEITEMS--;
free(msg); free(msg);
} }
} }*/
//printf("iterate_MSG allflag.%d width.%d channel.%d msgid.%d src.%llx -> %llx\n",allflag,origwidth,channel,msgid,(long long)srchash.txid,(long long)desthash.txid); //printf("iterate_MSG allflag.%d width.%d channel.%d msgid.%d src.%llx -> %llx\n",allflag,origwidth,channel,msgid,(long long)srchash.txid,(long long)desthash.txid);
fprintf(stderr,"["); fprintf(stderr,"[");
for (i=0; i<width; i++) for (i=0; i<width; i++)
@ -119,9 +119,9 @@ char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_
keylen = basilisk_messagekey(key,channel,msgid,srchash,desthash); keylen = basilisk_messagekey(key,channel,msgid,srchash,desthash);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg0.(%s)\n",jprint(item,0)); jaddi(array,item);//, printf("gotmsg0.(%s)\n",jprint(item,0));
keylen = basilisk_messagekey(key,channel,msgid,desthash,srchash); //keylen = basilisk_messagekey(key,channel,msgid,desthash,srchash);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) //if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg0.(%s)\n",jprint(item,0)); // jaddi(array,item);//, printf("gotmsg0.(%s)\n",jprint(item,0));
if ( origwidth > 0 ) if ( origwidth > 0 )
{ {
if ( bits256_nonz(srchash) != 0 ) if ( bits256_nonz(srchash) != 0 )
@ -129,18 +129,18 @@ char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_
keylen = basilisk_messagekey(key,channel,msgid,zero,desthash); keylen = basilisk_messagekey(key,channel,msgid,zero,desthash);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg1.(%s)\n",jprint(item,0)); jaddi(array,item);//, printf("gotmsg1.(%s)\n",jprint(item,0));
keylen = basilisk_messagekey(key,channel,msgid,desthash,zero); //keylen = basilisk_messagekey(key,channel,msgid,desthash,zero);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) //if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg1.(%s)\n",jprint(item,0)); // jaddi(array,item);//, printf("gotmsg1.(%s)\n",jprint(item,0));
} }
if ( bits256_nonz(desthash) != 0 ) if ( bits256_nonz(desthash) != 0 )
{ {
keylen = basilisk_messagekey(key,channel,msgid,srchash,zero); keylen = basilisk_messagekey(key,channel,msgid,srchash,zero);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg2.(%s)\n",jprint(item,0)); jaddi(array,item);//, printf("gotmsg2.(%s)\n",jprint(item,0));
keylen = basilisk_messagekey(key,channel,msgid,zero,srchash); //keylen = basilisk_messagekey(key,channel,msgid,zero,srchash);
if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 ) //if ( (item= _basilisk_respond_getmessage(myinfo,key,keylen)) != 0 )
jaddi(array,item);//, printf("gotmsg2.(%s)\n",jprint(item,0)); // jaddi(array,item);//, printf("gotmsg2.(%s)\n",jprint(item,0));
} }
if ( bits256_nonz(srchash) != 0 && bits256_nonz(desthash) != 0 ) if ( bits256_nonz(srchash) != 0 && bits256_nonz(desthash) != 0 )
{ {

Loading…
Cancel
Save