Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
bdc843882e
  1. 15
      iguana/SuperNET.c
  2. 1
      iguana/iguana_instantdex.c
  3. 2
      iguana/iguana_msg.c

15
iguana/SuperNET.c

@ -573,7 +573,12 @@ char *SuperNET_DHTsend(struct supernet_info *myinfo,uint64_t destipbits,bits256
{ {
char str[65]; printf("duplicate hex.(%s) for %s\n",hexmsg,bits256_str(str,categoryhash)); char str[65]; printf("duplicate hex.(%s) for %s\n",hexmsg,bits256_str(str,categoryhash));
return(clonestr("{\"error\":\"duplicate packet rejected\"}")); return(clonestr("{\"error\":\"duplicate packet rejected\"}"));
} else SuperNET_hexmsgadd(myinfo,categoryhash,subhash,hexmsg,tai_now(),0); }
else
{
printf("DHT send\n");
SuperNET_hexmsgadd(myinfo,categoryhash,subhash,hexmsg,tai_now(),0);
}
jsonstr = jprint(json,1); jsonstr = jprint(json,1);
if ( broadcastflag != 0 || destipbits == 0 ) if ( broadcastflag != 0 || destipbits == 0 )
{ {
@ -585,6 +590,8 @@ char *SuperNET_DHTsend(struct supernet_info *myinfo,uint64_t destipbits,bits256
{ {
addr = &Coins[i]->peers.active[j]; addr = &Coins[i]->peers.active[j];
if ( addr->usock >= 0 && addr->supernet != 0 && (broadcastflag != 0 || category_peer(myinfo,addr,categoryhash,subhash) >= 0) ) if ( addr->usock >= 0 && addr->supernet != 0 && (broadcastflag != 0 || category_peer(myinfo,addr,categoryhash,subhash) >= 0) )
{
if ( strcmp("0.0.0.0",addr->ipaddr) != 0 && strcmp("127.0.0.1",addr->ipaddr) != 0 )
{ {
char str[65]; printf("BROADCAST[%d] crc.%x %s SEND.(%d) to %s\n",j,calc_crc32(0,jsonstr,(int32_t)strlen(jsonstr)),bits256_str(str,categoryhash),(int32_t)strlen(jsonstr),addr->ipaddr); char str[65]; printf("BROADCAST[%d] crc.%x %s SEND.(%d) to %s\n",j,calc_crc32(0,jsonstr,(int32_t)strlen(jsonstr)),bits256_str(str,categoryhash),(int32_t)strlen(jsonstr),addr->ipaddr);
iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:(rand()%maxdelay)); iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:(rand()%maxdelay));
@ -592,6 +599,7 @@ char *SuperNET_DHTsend(struct supernet_info *myinfo,uint64_t destipbits,bits256
} }
} }
} }
}
return(clonestr("{\"result\":\"packet sent to all peers\"}")); return(clonestr("{\"result\":\"packet sent to all peers\"}"));
} }
if ( (addr= iguana_peerfind(myinfo,&coin,destipbits,categoryhash,subhash)) == 0 ) if ( (addr= iguana_peerfind(myinfo,&coin,destipbits,categoryhash,subhash)) == 0 )
@ -693,7 +701,7 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,ui
{ {
if ( SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 ) if ( SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 )
{ {
//printf("add.(%s)\n",hexmsg); printf("FORWARD.(%s)\n",hexmsg);
newflag = 1; newflag = 1;
SuperNET_hexmsgadd(myinfo,category,subhash,hexmsg,tai_now(),remoteaddr); SuperNET_hexmsgadd(myinfo,category,subhash,hexmsg,tai_now(),remoteaddr);
forwardstr = SuperNET_forward(myinfo,hexmsg,destipbits,category,subhash,maxdelay,juint(json,"broadcast"),juint(json,"plaintext")!=0); forwardstr = SuperNET_forward(myinfo,hexmsg,destipbits,category,subhash,maxdelay,juint(json,"broadcast"),juint(json,"plaintext")!=0);
@ -703,7 +711,10 @@ char *SuperNET_JSON(struct supernet_info *myinfo,cJSON *json,char *remoteaddr,ui
if ( (destflag & SUPERNET_ISMINE) != 0 && agent != 0 && method != 0 ) if ( (destflag & SUPERNET_ISMINE) != 0 && agent != 0 && method != 0 )
{ {
if ( strcmp(agent,"bitcoinrpc") != 0 && newflag == 0 && hexmsg != 0 && SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 ) if ( strcmp(agent,"bitcoinrpc") != 0 && newflag == 0 && hexmsg != 0 && SuperNET_hexmsgfind(myinfo,category,subhash,hexmsg,0) < 0 )
{
printf("SuperNET_JSON hexmsgadd\n");
SuperNET_hexmsgadd(myinfo,category,subhash,hexmsg,tai_now(),remoteaddr); SuperNET_hexmsgadd(myinfo,category,subhash,hexmsg,tai_now(),remoteaddr);
}
if ( (retstr= SuperNET_processJSON(myinfo,json,remoteaddr,port)) != 0 ) if ( (retstr= SuperNET_processJSON(myinfo,json,remoteaddr,port)) != 0 )
{ {
//printf("retstr.(%s)\n",retstr); //printf("retstr.(%s)\n",retstr);

1
iguana/iguana_instantdex.c

@ -801,6 +801,7 @@ int32_t instantdex_quote(struct supernet_info *myinfo,struct iguana_info *coin,s
if ( (ap= instantdex_quotefind(myinfo,coin,addr,encodedhash)) == 0 ) if ( (ap= instantdex_quotefind(myinfo,coin,addr,encodedhash)) == 0 )
{ {
init_hexbytes_noT(hexstr,serialized,recvlen); init_hexbytes_noT(hexstr,serialized,recvlen);
printf("quote send\n");
SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,hexstr,tai_now(),addr->ipaddr); SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,hexstr,tai_now(),addr->ipaddr);
} }
else else

2
iguana/iguana_msg.c

@ -600,12 +600,14 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
else if ( strcmp(H->command,"InstantDEX") == 0 ) else if ( strcmp(H->command,"InstantDEX") == 0 )
{ {
init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen); init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen);
printf("peer InstantDEX message\n");
SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr); SuperNET_hexmsgadd(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr);
return(0); return(0);
} }
else if ( strcmp(H->command,"pangea") == 0 ) else if ( strcmp(H->command,"pangea") == 0 )
{ {
init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen); init_hexbytes_noT(addr->TXDATA.ptr,data,recvlen);
printf("pangea InstantDEX message\n");
SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr); SuperNET_hexmsgadd(myinfo,myinfo->pangea_category,GENESIS_PUBKEY,addr->TXDATA.ptr,tai_now(),addr->ipaddr);
return(0); return(0);
} }

Loading…
Cancel
Save