From 2bfac1ae23a42dcda2eb21cea7b8e11ff427423c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 8 Jan 2016 18:21:55 -0300 Subject: [PATCH] test --- iguana/iguana_msg.c | 2 +- iguana/iguana_peers.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_msg.c b/iguana/iguana_msg.c index afdd45ad7..ffc19c40e 100755 --- a/iguana/iguana_msg.c +++ b/iguana/iguana_msg.c @@ -127,7 +127,7 @@ int32_t iguana_rwblockhash(int32_t rwflag,uint8_t *serialized,uint32_t *nVersion int32_t iguana_send_supernet(struct iguana_info *coin,struct iguana_peer *addr,char *jsonstr,int32_t delaymillis) { int32_t len; uint8_t serialized[8192]; - if ( addr->supernet != 0 && (len= (int32_t)strlen(jsonstr)) < sizeof(serialized)-sizeof(struct iguana_msghdr) ) + if ( (len= (int32_t)strlen(jsonstr)) < sizeof(serialized)-sizeof(struct iguana_msghdr) ) { memcpy(&serialized[sizeof(struct iguana_msghdr)],jsonstr,len+1); printf("SEND.(%s) -> (%s)\n",jsonstr,addr->ipaddr); diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 589276d9d..a6a28472c 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -352,7 +352,8 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s if ( usock < 0 || addr->dead != 0 ) return(-1); remains = len; - //printf(" send.(%s) %d bytes to %s\n",(char *)&serialized[4],len,addr->ipaddr);// getchar(); + //if ( strcmp((char *)&serialized[4],"SuperNET") == 0 || addr->supernet != 0 ) + printf(" >>>>>>> send.(%s) %d bytes to %s\n",(char *)&serialized[4],len,addr->ipaddr);// getchar(); if ( strcmp((char *)&serialized[4],"ping") == 0 ) addr->sendmillis = OS_milliseconds(); if ( len > IGUANA_MAXPACKETSIZE ) @@ -483,7 +484,7 @@ void _iguana_processmsg(struct iguana_info *coin,int32_t usock,struct iguana_pee int32_t len,recvlen; void *buf = _buf; struct iguana_msghdr H; if ( coin->peers.shuttingdown != 0 || addr->dead != 0 ) return; - if ( addr->supernet != 0 ) + if ( 0 && addr->supernet != 0 ) printf("%p got.(%s) from %s | usock.%d ready.%u dead.%u\n",addr,H.command,addr->ipaddr,addr->usock,addr->ready,addr->dead); memset(&H,0,sizeof(H)); if ( (recvlen= (int32_t)iguana_recv(usock,(uint8_t *)&H,sizeof(H))) == sizeof(H) ) @@ -905,6 +906,8 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr) bufsize = IGUANA_MAXPACKETSIZE; buf = mycalloc('r',1,bufsize); printf("send version myservices.%llu to (%s)\n",(long long)coin->myservices,addr->ipaddr); + //if ( addr->supernet != 0 ) + iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0); sleep(1); iguana_send_version(coin,addr,coin->myservices); printf("after send version\n");