From 936b64d1321ca74e67603c1865cfbb57d520c6f6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 10 May 2016 19:54:03 -0500 Subject: [PATCH] test --- iguana/iguana_instantdex.c | 1 + iguana/iguana_peers.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index 87022e230..57800f472 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -361,6 +361,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o //hexstr = malloc(msg->sig.allocsize*2 + 1); //init_hexbytes_noT(hexstr,(uint8_t *)msg,msg->sig.allocsize); //retstr = SuperNET_categorymulticast(myinfo,0,myinfo->instantdex_category,desthash,hexstr,0,hops,1,argjson,0); + memset(serialized,0,sizeof(struct iguana_msghdr)); memcpy(&serialized[sizeof(struct iguana_msghdr)],(uint8_t *)msg,msg->sig.allocsize); if ( (coin= iguana_coinfind("BTCD")) != 0 && (max= coin->peers.numranked) > 0 ) { diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 93b844759..1be182957 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -458,6 +458,8 @@ int32_t iguana_send(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *s int32_t iguana_queue_send(struct iguana_info *coin,struct iguana_peer *addr,int32_t delay,uint8_t *serialized,char *cmd,int32_t len,int32_t getdatablock,int32_t forceflag) { struct iguana_packet *packet; int32_t datalen; + if ( (datalen= iguana_sethdr((void *)serialized,coin->chain->netmagic,cmd,&serialized[sizeof(struct iguana_msghdr)],len)) < 0 ) + return(-1); if ( addr == 0 ) { printf("iguana_queue_send null addr\n"); @@ -465,10 +467,10 @@ int32_t iguana_queue_send(struct iguana_info *coin,struct iguana_peer *addr,int3 return(-1); } else if ( forceflag != 0 ) + { return(iguana_send(coin,addr,serialized,len)); + } - if ( (datalen= iguana_sethdr((void *)serialized,coin->chain->netmagic,cmd,&serialized[sizeof(struct iguana_msghdr)],len)) < 0 ) - return(-1); if ( strcmp("getaddr",cmd) == 0 && time(NULL) < addr->lastgotaddr+300 ) return(0); //if ( strcmp("version",cmd) == 0 ) @@ -587,7 +589,9 @@ void _iguana_processmsg(struct iguana_info *coin,int32_t usock,struct iguana_pee myfree(buf,len); return; } - printf("invalid header received from (%s)\n",addr->ipaddr); + int32_t i; for (i=0; iipaddr); addr->dead = 1; } // printf("%s recv error on hdr errno.%d (%s) -> zombify\n",addr->ipaddr,-recvlen,strerror(-recvlen));