Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
3d0266eec6
  1. 2
      basilisk/basilisk.c
  2. 9
      basilisk/basilisk_MSG.c
  3. 2
      basilisk/basilisk_ping.c

2
basilisk/basilisk.c

@ -623,9 +623,9 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
//origcmd[0] = 0; //origcmd[0] = 0;
if ( myinfo->RELAYID >= 0 ) if ( myinfo->RELAYID >= 0 )
{ {
printf("MSGPROCESS %s.(%s) tag.%d\n",CMD,(char *)data,basilisktag);
if ( basilisk_specialcmd(CMD) == 0 ) if ( basilisk_specialcmd(CMD) == 0 )
return; return;
printf("MSGPROCESS %s.(%s) tag.%d\n",CMD,(char *)data,basilisktag);
} }
symbol = "BTCD"; symbol = "BTCD";
if ( senderipbits == 0 ) if ( senderipbits == 0 )

9
basilisk/basilisk_MSG.c

@ -17,7 +17,7 @@
char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration) char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration)
{ {
struct basilisk_message *msg; struct basilisk_message *msg; int32_t i;
if ( keylen == BASILISK_KEYSIZE ) if ( keylen == BASILISK_KEYSIZE )
{ {
msg = calloc(1,sizeof(*msg) + datalen); msg = calloc(1,sizeof(*msg) + datalen);
@ -33,6 +33,9 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
memcpy(msg->data,data,datalen); memcpy(msg->data,data,datalen);
portable_mutex_lock(&myinfo->messagemutex); portable_mutex_lock(&myinfo->messagemutex);
HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg); HASH_ADD_KEYPTR(hh,myinfo->messagetable,msg->key,msg->keylen,msg);
for (i=0; i<BASILISK_KEYSIZE; i++)
printf("%02x",key[i]);
printf(" <- ADDMSG.[%d]\n",QUEUEITEMS);
QUEUEITEMS++; QUEUEITEMS++;
portable_mutex_unlock(&myinfo->messagemutex); portable_mutex_unlock(&myinfo->messagemutex);
if ( sendping != 0 ) if ( sendping != 0 )
@ -85,8 +88,8 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha
keylen = basilisk_messagekey(key,juint(valsobj,"channel"),juint(valsobj,"msgid"),senderhash,hash); keylen = basilisk_messagekey(key,juint(valsobj,"channel"),juint(valsobj,"msgid"),senderhash,hash);
if( bits256_nonz(senderhash) == 0 && bits256_nonz(hash) == 0 && duration > BASILISK_MSGDURATION ) if( bits256_nonz(senderhash) == 0 && bits256_nonz(hash) == 0 && duration > BASILISK_MSGDURATION )
duration = BASILISK_MSGDURATION; duration = BASILISK_MSGDURATION;
printf("OUT keylen.%d datalen.%d\n",keylen,datalen); // 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)); // 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(basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,1,duration)); return(basilisk_respond_addmessage(myinfo,key,keylen,data,datalen,1,duration));
} }

2
basilisk/basilisk_ping.c

@ -133,7 +133,7 @@ int32_t basilisk_ping_processMSG(struct supernet_info *myinfo,uint32_t senderipb
printf("illegal msglen.%d or len.%d > %d\n",msglen,len,datalen); printf("illegal msglen.%d or len.%d > %d\n",msglen,len,datalen);
return(0); return(0);
} }
printf("i.%d: keylen.%d msglen.%d\n",i,keylen,msglen); //printf("i.%d: keylen.%d msglen.%d\n",i,keylen,msglen);
basilisk_respond_addmessage(myinfo,key,keylen,msg,msglen,0,duration); basilisk_respond_addmessage(myinfo,key,keylen,msg,msglen,0,duration);
} }
} }

Loading…
Cancel
Save