Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
0252ba13e4
  1. 2
      basilisk/basilisk.c
  2. 7
      basilisk/basilisk_MSG.c

2
basilisk/basilisk.c

@ -844,7 +844,7 @@ void basilisks_loop(void *arg)
//printf(">>>>>>>>>>>>> update finished\n"); //printf(">>>>>>>>>>>>> update finished\n");
} }
} }
if ( 0 && RELAYID < 0 && myinfo->expiration != 0 ) if ( RELAYID < 0 && myinfo->expiration != 0 )
basilisk_requests_poll(myinfo); basilisk_requests_poll(myinfo);
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
portable_mutex_lock(&myinfo->messagemutex); portable_mutex_lock(&myinfo->messagemutex);

7
basilisk/basilisk_MSG.c

@ -50,7 +50,6 @@ char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int3
cJSON *basilisk_respond_getmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen) cJSON *basilisk_respond_getmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen)
{ {
cJSON *msgjson=0; struct basilisk_message *msg; char *ptr = 0,strbuf[32768]; cJSON *msgjson=0; struct basilisk_message *msg; char *ptr = 0,strbuf[32768];
{int32_t i; for (i=0; i<keylen; i++) printf("%02x",key[i]); printf(" search key\n");}
portable_mutex_lock(&myinfo->messagemutex); portable_mutex_lock(&myinfo->messagemutex);
HASH_FIND(hh,myinfo->messagetable,key,keylen,msg); HASH_FIND(hh,myinfo->messagetable,key,keylen,msg);
if ( msg != 0 ) if ( msg != 0 )
@ -60,7 +59,8 @@ cJSON *basilisk_respond_getmessage(struct supernet_info *myinfo,uint8_t *key,int
msgjson = cJSON_CreateObject(); msgjson = cJSON_CreateObject();
jaddnum(msgjson,"expiration",msg->expiration); jaddnum(msgjson,"expiration",msg->expiration);
jaddnum(msgjson,"duration",msg->duration); jaddnum(msgjson,"duration",msg->duration);
printf("havemessage len.%d\n",msg->datalen); {int32_t i; for (i=0; i<keylen; i++) printf("%02x",key[i]);
printf("havemessage len.%d\n",msg->datalen); }
} else printf("basilisk_respond_getmessage: couldnt basilisk_addhexstr\n"); } else printf("basilisk_respond_getmessage: couldnt basilisk_addhexstr\n");
} }
portable_mutex_unlock(&myinfo->messagemutex); portable_mutex_unlock(&myinfo->messagemutex);
@ -154,6 +154,7 @@ char *basilisk_respond_MSG(struct supernet_info *myinfo,char *CMD,void *addr,cha
HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr) HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
{ {
uint32_t msgid,width,channel; uint32_t msgid,width,channel;
jaddbits256(vals,"sender",myinfo->myaddr.persistent);
if ( (msgid= juint(vals,"msgid")) == 0 ) if ( (msgid= juint(vals,"msgid")) == 0 )
{ {
msgid = (uint32_t)time(NULL); msgid = (uint32_t)time(NULL);
@ -165,7 +166,7 @@ HASH_ARRAY_STRING(basilisk,getmessage,hash,vals,hexstr)
channel = juint(vals,"channel"); channel = juint(vals,"channel");
width = juint(vals,"width"); width = juint(vals,"width");
return(basilisk_iterate_MSG(myinfo,channel,msgid,hash,myinfo->myaddr.persistent,width)); return(basilisk_iterate_MSG(myinfo,channel,msgid,hash,myinfo->myaddr.persistent,width));
} else return(basilisk_standardservice("MSG",myinfo,0,myinfo->myaddr.persistent,vals,hexstr,1)); } else return(basilisk_standardservice("MSG",myinfo,0,hash,vals,hexstr,1));
} }
HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr) HASH_ARRAY_STRING(basilisk,sendmessage,hash,vals,hexstr)

Loading…
Cancel
Save