Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ea49fb2542
  1. 5
      iguana/SuperNET.c

5
iguana/SuperNET.c

@ -259,6 +259,7 @@ int32_t SuperNET_destination(struct supernet_info *myinfo,uint32_t *destipbitsp,
char *destip; int32_t destflag = SUPERNET_FORWARD; char *destip; int32_t destflag = SUPERNET_FORWARD;
if ( (destip= jstr(json,"destip")) != 0 ) if ( (destip= jstr(json,"destip")) != 0 )
*destipbitsp = (uint32_t)calc_ipbits(destip); *destipbitsp = (uint32_t)calc_ipbits(destip);
else *destipbitsp = 0;
*maxdelayp = juint(json,"delay"); *maxdelayp = juint(json,"delay");
*destpubp = jbits256(json,"destpub"); *destpubp = jbits256(json,"destpub");
if ( *destipbitsp == myinfo->myaddr.selfipbits ) if ( *destipbitsp == myinfo->myaddr.selfipbits )
@ -275,7 +276,9 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr)
char *forwardstr=0,*retstr=0,*agent,*method,*message,*jsonstr=0; char *forwardstr=0,*retstr=0,*agent,*method,*message,*jsonstr=0;
if ( remoteaddr != 0 && strcmp(remoteaddr,"127.0.0.1") == 0 ) if ( remoteaddr != 0 && strcmp(remoteaddr,"127.0.0.1") == 0 )
remoteaddr = 0; remoteaddr = 0;
printf("SuperNET_JSON.(%s) remote.(%s)\n",jprint(json,0),remoteaddr!=0?remoteaddr:"");
destflag = SuperNET_destination(myinfo,&destipbits,&destpub,&maxdelay,json); destflag = SuperNET_destination(myinfo,&destipbits,&destpub,&maxdelay,json);
printf("destflag.%d\n",destflag);
if ( (destflag & SUPERNET_FORWARD) != 0 ) if ( (destflag & SUPERNET_FORWARD) != 0 )
{ {
if ( (message= jstr(json,"message")) == 0 ) if ( (message= jstr(json,"message")) == 0 )
@ -336,6 +339,6 @@ char *SuperNET_p2p(struct iguana_info *coin,struct iguana_peer *addr,int32_t *de
retstr = SuperNET_JSON(myinfo,json,ipaddr); retstr = SuperNET_JSON(myinfo,json,ipaddr);
*delaymillisp = SuperNET_delaymillis(myinfo,maxdelay); *delaymillisp = SuperNET_delaymillis(myinfo,maxdelay);
free_json(json); free_json(json);
} } else retstr = clonestr("{\"error\":\"p2p cant parse json\"}");
return(retstr); return(retstr);
} }

Loading…
Cancel
Save