Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e0e646bbab
  1. 24
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk_CMD.c
  3. 2
      iguana/iguana_chains.c
  4. 2
      iguana/tests/get
  5. 2
      iguana/tests/set

24
basilisk/basilisk.c

@ -651,7 +651,7 @@ HASH_ARRAY_STRING(basilisk,addrelay,pubkey,vals,hexstr)
HASH_ARRAY_STRING(basilisk,dispatch,pubkey,vals,hexstr)
{
return(basilisk_standardservice("RUN",&basilisk_request_dispatch,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("RUN",&basilisk_request_dispatch,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,publish,pubkey,vals,hexstr)
@ -661,7 +661,7 @@ HASH_ARRAY_STRING(basilisk,publish,pubkey,vals,hexstr)
HASH_ARRAY_STRING(basilisk,subscribe,pubkey,vals,hexstr)
{
return(basilisk_standardservice("SUB",&basilisk_request_subscribe,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("SUB",&basilisk_request_subscribe,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,setfield,pubkey,vals,hexstr)
@ -671,7 +671,9 @@ HASH_ARRAY_STRING(basilisk,setfield,pubkey,vals,hexstr)
HASH_ARRAY_STRING(basilisk,getfield,pubkey,vals,hexstr)
{
return(basilisk_standardservice("GET",&basilisk_request_getfield,myinfo,pubkey,vals,hexstr,0));
if ( jobj(vals,"timeout") == 0 )
jaddnum(vals,"timeout",BASILISK_TIMEOUT);
return(basilisk_standardservice("GET",&basilisk_request_getfield,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,forward,pubkey,vals,hexstr)
@ -681,32 +683,32 @@ HASH_ARRAY_STRING(basilisk,forward,pubkey,vals,hexstr)
HASH_ARRAY_STRING(basilisk,mailbox,pubkey,vals,hexstr)
{
return(basilisk_standardservice("BOX",&basilisk_request_mailbox,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("BOX",&basilisk_request_mailbox,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNcreate,pubkey,vals,hexstr)
{
return(basilisk_standardservice("HUB",&basilisk_request_VPNcreate,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("HUB",&basilisk_request_VPNcreate,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNjoin,pubkey,vals,hexstr)
{
return(basilisk_standardservice("ARC",&basilisk_request_VPNjoin,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("ARC",&basilisk_request_VPNjoin,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNmessage,pubkey,vals,hexstr)
{
return(basilisk_standardservice("GAB",&basilisk_request_VPNmessage,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("GAB",&basilisk_request_VPNmessage,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNbroadcast,pubkey,vals,hexstr)
{
return(basilisk_standardservice("SAY",&basilisk_request_VPNbroadcast,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("SAY",&basilisk_request_VPNbroadcast,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNreceive,pubkey,vals,hexstr)
{
return(basilisk_standardservice("EAR",&basilisk_request_VPNreceive,myinfo,pubkey,vals,hexstr,0));
return(basilisk_standardservice("EAR",&basilisk_request_VPNreceive,myinfo,pubkey,vals,hexstr,1));
}
HASH_ARRAY_STRING(basilisk,VPNlogout,pubkey,vals,hexstr)
@ -790,6 +792,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender
basilisk_sendcmd(myinfo,0,cmd,rand(),0,0,origdata,origlen,-1); // to other iguanas
if ( (retstr= (*basilisk_services[i][1])(myinfo,type,addr,remoteaddr,basilisktag,valsobj,data,datalen,pubkey,from_basilisk)) != 0 )
{
printf("from_basilisk.%d ret.(%s)\n",from_basilisk,retstr);
if ( from_basilisk != 0 )
basilisk_sendback(myinfo,symbol,remoteaddr,basilisktag,retstr);
if ( retstr != 0 )
@ -808,6 +811,9 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender
if ( strcmp((char *)basilisk_coinservices[i][0],type) == 0 )
{
retstr = (*basilisk_coinservices[i][1])(myinfo,coin,addr,remoteaddr,basilisktag,valsobj,data,datalen);
printf("from_basilisk.%d ret.(%s)\n",from_basilisk,retstr);
if ( from_basilisk != 0 )
basilisk_sendback(myinfo,symbol,remoteaddr,basilisktag,retstr);
break;
}
}

2
basilisk/basilisk_CMD.c

@ -82,7 +82,7 @@ char *basilisk_respond_getfield(struct supernet_info *myinfo,char *CMD,struct ig
struct basilisk_item *basilisk_request_getfield(struct basilisk_item *Lptr,struct supernet_info *myinfo,bits256 prevhash,cJSON *valsobj,uint8_t *data,int32_t datalen)
{
bits256 cathash; char *category;
if ( datalen <= 0 || (category= jstr(valsobj,"category")) == 0 )
if ( (category= jstr(valsobj,"category")) == 0 )
return(0);
vcalc_sha256(0,cathash.bytes,(uint8_t *)category,(int32_t)strlen(category));
return(basilisk_requestservice(Lptr,myinfo,"GET",0,valsobj,prevhash));

2
iguana/iguana_chains.c

@ -319,7 +319,7 @@ void iguana_chainparms(struct iguana_chain *chain,cJSON *argjson)
if ( (chain->ramchainport= juint(argjson,"ramchain")) == 0 )
chain->ramchainport = chain->portp2p - 1;
if ( (chain->rpcport= juint(argjson,"rpc")) == 0 )
chain->rpcport = chain->portp2p + 1;
chain->rpcport = chain->portp2p - 1;
if ( jobj(argjson,"isPoS") != 0 )
chain->hastimestamp = juint(argjson,"isPoS");
else if ( jobj(argjson,"oldtx_format") != 0 )

2
iguana/tests/get

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"getfield\",\"category\":\"test\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"getfield\",\"vals\":{\"category\":\"test\"}}"

2
iguana/tests/set

@ -1 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"setfield\",\"vals\":{\"setfield\":\"setthis\"},\"hexstr\":\"beefdead\",\"category\":\"test\"}"
curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"basilisk\",\"method\":\"setfield\",\"vals\":{\"setfield\":\"setthis\",\"category\":\"test\"},\"hexstr\":\"beefdead\"}"

Loading…
Cancel
Save