From 8cd83227dea77f90c0fa799c3a98ec5d1a61d739 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 18 Jan 2016 06:01:10 -0300 Subject: [PATCH] test --- iguana/SuperNET.c | 21 ++++++++++++--------- iguana/iguana_peers.c | 5 ++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/iguana/SuperNET.c b/iguana/SuperNET.c index 167a22925..1cbde0b12 100644 --- a/iguana/SuperNET.c +++ b/iguana/SuperNET.c @@ -122,6 +122,8 @@ int32_t SuperNET_json2bits(struct supernet_info *myinfo,int32_t validpub,uint8_t else priv = GENESIS_PRIVKEY; seed = curve25519_shared(priv,destpub); vcalc_sha256(0,seed2.bytes,seed.bytes,sizeof(seed)); + + memset(seed2.bytes,0,sizeof(seed2)); //char str[65],str2[65],str3[65],str4[65]; //int32_t i; for (i=0; iiphash.bytes,routehash.bytes,sizeof(addr->iphash)) == 0 ) { printf("DHT send\n"); - iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:rand()%maxdelay); + iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:(rand()%maxdelay)); return(clonestr("{\"result\":\"packet sent directly to destip\"}")); } else if ( iter == 1 ) { //if ( DHT_dist(packethash,addr->iphash) < mydist ) { - iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:rand()%maxdelay); + iguana_send_supernet(Coins[i],addr,jsonstr,maxdelay==0?0:(rand()%maxdelay)); n++; } } diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 816f94e7d..6ca99d37d 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -488,9 +488,12 @@ void _iguana_processmsg(struct iguana_info *coin,int32_t usock,struct iguana_pee memset(&H,0,sizeof(H)); if ( (recvlen= (int32_t)iguana_recv(addr->ipaddr,usock,(uint8_t *)&H,sizeof(H))) == sizeof(H) ) { - printf("%p got.(%s) recvlen.%d from %s | usock.%d ready.%u dead.%u\n",addr,H.command,recvlen,addr->ipaddr,addr->usock,addr->ready,addr->dead); if ( coin->peers.shuttingdown != 0 || addr->dead != 0 ) return; + { + iguana_rwnum(0,H.serdatalen,sizeof(H.serdatalen),(uint32_t *)&len); + printf("%p got.(%s) recvlen.%d from %s | usock.%d ready.%u dead.%u len.%d\n",addr,H.command,recvlen,addr->ipaddr,addr->usock,addr->ready,addr->dead,len); + } if ( (len= iguana_validatehdr(&H)) >= 0 ) { if ( len > 0 )