jl777 8 years ago
parent
commit
adcc4a175d
  1. 24
      basilisk/basilisk_MSG.c
  2. 4
      iguana/iguana_rpc.c

24
basilisk/basilisk_MSG.c

@ -85,6 +85,16 @@ cJSON *basilisk_respond_getmessage(struct supernet_info *myinfo,uint8_t *key,int
// respond to incoming OUT, MSG
int32_t basilisk_messagekeyread(uint8_t *key,uint32_t *channelp,uint32_t *msgidp,bits256 *srchashp,bits256 *desthashp)
{
int32_t keylen = 0;
keylen += iguana_rwnum(0,&key[keylen],sizeof(uint32_t),channelp);
keylen += iguana_rwnum(0,&key[keylen],sizeof(uint32_t),msgidp);
keylen += iguana_rwbignum(0,&key[keylen],sizeof(*srchashp),srchashp->bytes);
keylen += iguana_rwbignum(0,&key[keylen],sizeof(*desthashp),desthashp->bytes);
return(keylen);
}
int32_t basilisk_messagekey(uint8_t *key,uint32_t channel,uint32_t msgid,bits256 srchash,bits256 desthash)
{
int32_t keylen = 0;
@ -114,7 +124,17 @@ char *basilisk_respond_OUT(struct supernet_info *myinfo,char *CMD,void *addr,cha
int32_t basilisk_msgcmp(struct basilisk_message *msg,int32_t width,uint32_t channel,uint32_t msgid,bits256 srchash,bits256 desthash)
{
return(-1);
uint32_t keychannel,keymsgid; bits256 keysrc,keydest;
basilisk_messagekeyread(msg->key,&keychannel,&keymsgid,&keysrc,&keydest);
if ( keymsgid >= msgid && keymsgid+width <= msgid && keychannel == channel )
{
if ( bits256_nonz(srchash) == 0 || bits256_cmp(srchash,keysrc) == 0 )
{
if ( bits256_nonz(desthash) == 0 || bits256_cmp(desthash,keydest) == 0 )
return(0);
else return(-1);
} else return(-2);
} else return(-3);
}
char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_t msgid,bits256 srchash,bits256 desthash,int32_t origwidth)
@ -130,7 +150,7 @@ char *basilisk_iterate_MSG(struct supernet_info *myinfo,uint32_t channel,uint32_
width = 1;
HASH_ITER(hh,myinfo->messagetable,msg,tmpmsg)
{
if ( msg->broadcast != 0 && basilisk_msgcmp(msg,width,channel,msgid,zero,zero) == 0 )
if ( msg->broadcast != 0 && basilisk_msgcmp(msg,origwidth,channel,msgid,zero,zero) == 0 )
jaddi(array,basilisk_msgjson(msg,msg->key,msg->keylen));
}
//printf("iterate_MSG width.%d channel.%d msgid.%d src.%llx -> %llx\n",origwidth,channel,msgid,(long long)srchash.txid,(long long)desthash.txid);

4
iguana/iguana_rpc.c

@ -836,7 +836,7 @@ cJSON *SuperNET_urlconv(char *value,int32_t bufsize,char *urlstr)
char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *postflagp,char *urlstr,char *remoteaddr,char *filetype,uint16_t port)
{
cJSON *tokens,*argjson,*origargjson,*json = 0; long filesize; struct iguana_info *coin = 0;
char symbol[64],buf[4096],urlmethod[16],*data,url[1024],furl[1024],*retstr,*filestr,*token = 0; int32_t i,j,n,num=0;
char symbol[64],buf[4096],urlmethod[16],*data,url[8192],furl[8192],*retstr,*filestr,*token = 0; int32_t i,j,n,num=0;
//printf("rpcparse.(%s)\n",urlstr);
if ( myinfo->remoteorigin == 0 )
{
@ -848,7 +848,7 @@ char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsiz
{
printf("remote Origin REJECT.(%s)\n",urlstr);
return(clonestr("{\"error\":\"remote origin not enabled\"}"));
}
} //else printf("allow file://\n");
break;
}
}

Loading…
Cancel
Save