Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
915a039db3
  1. 6
      basilisk/basilisk_MSG.c

6
basilisk/basilisk_MSG.c

@ -18,8 +18,11 @@
char *basilisk_respond_sendmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping)
{
struct basilisk_message *msg;
if ( keylen == sizeof(bits256)+sizeof(uint32_t)*2 )
{
msg = calloc(1,sizeof(*msg) + datalen);
msg->expiration = (uint32_t)time(NULL) + INSTANTDEX_LOCKTIME*2;
msg->keylen = keylen;
memcpy(msg->key,key,keylen);
msg->datalen = datalen;
memcpy(msg->data,data,datalen);
@ -31,6 +34,7 @@ char *basilisk_respond_sendmessage(struct supernet_info *myinfo,uint8_t *key,int
queue_enqueue("basilisk_message",&myinfo->msgQ,&msg->DL,0);
return(clonestr("{\"result\":\"message added to hashtable\"}"));
} else return(0);
} else return(0);
}
int32_t basilisk_ping_processMSG(struct supernet_info *myinfo,uint32_t senderipbits,uint8_t *data,int32_t datalen)
@ -42,6 +46,8 @@ int32_t basilisk_ping_processMSG(struct supernet_info *myinfo,uint32_t senderipb
for (i=0; i<num; i++)
{
keylen = data[len++];
if ( keylen != sizeof(bits256)+sizeof(uint32_t)*2 )
return(0);
key = &data[len], len += keylen;
if ( len+sizeof(msglen) > datalen )
return(0);

Loading…
Cancel
Save