Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
23b84705c4
  1. 10
      iguana/iguana_bundles.c
  2. 6
      iguana/iguana_instantdex.c
  3. 6
      iguana/iguana_peers.c

10
iguana/iguana_bundles.c

@ -1405,10 +1405,14 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
//sprintf(str+strlen(str),"%s.%-2d %s time %.2f files.%d Q.%d %d\n",coin->symbol,flag,str,(double)(time(NULL)-coin->starttime)/60.,coin->peers.numfiles,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ));
if ( time(NULL) > coin->lastdisp+7 && (strcmp(str,coin->lastdispstr) != 0 || time(NULL) > coin->lastdisp+60) )
{
printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,queue_size(&bundlesQ),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
static FILE *logfp;
if ( logfp == 0 )
logfp = fopen("debug.log","wb");
if ( logfp != 0 )
fprintf(logfp,"%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,queue_size(&bundlesQ),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck);
strcpy(coin->lastdispstr,str);
if ( (rand() % 100) == 0 )
myallocated(0,0);
//if ( (rand() % 100) == 0 )
// myallocated(0,0);
coin->lastdisp = (uint32_t)time(NULL);
}
iguana_setmaxbundles(coin);

6
iguana/iguana_instantdex.c

@ -320,7 +320,7 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru
char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen)
{
char *reqstr; struct instantdex_msghdr *msg; bits256 orderhash; struct iguana_info *coin; struct iguana_peer *addr; int32_t i,j,r,olen,slen,datalen,max; uint8_t serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096]; uint64_t nxt64bits;
char *reqstr; struct instantdex_msghdr *msg; bits256 orderhash; struct iguana_info *coin; struct iguana_peer *addr; int32_t i,j,r,olen,slen,datalen,max=-1; uint8_t serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096]; uint64_t nxt64bits;
category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY);
jaddstr(argjson,"cmd",cmdstr);
jaddstr(argjson,"agent","SuperNET");
@ -374,9 +374,9 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
iguana_queue_send(coin,addr,0,serialized,"InstantDEX",msg->sig.allocsize,0,1);
if ( --hops <= 0 )
break;
} else printf("skip.%d addr.%p\n",j,addr);
}
}
}
} else printf("cant find coin.%p or no ranked.%d\n",coin,max);
free(msg); //free(hexstr),
return(jprint(argjson,1));
}

6
iguana/iguana_peers.c

@ -644,7 +644,7 @@ void iguana_startconnection(void *arg)
printf("avoid self-loopback\n");
return;
}
printf("startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind);
//printf("startconnection.(%s) pending.%u usock.%d addrind.%d\n",addr->ipaddr,addr->pending,addr->usock,addr->addrind);
addr->pending = (uint32_t)time(NULL);
if ( (port= (uint16_t)(addr->ipbits >> 32)) == 0 )
port = coin->chain->portp2p;
@ -653,7 +653,7 @@ void iguana_startconnection(void *arg)
if ( addr->usock < 0 || coin->peers.shuttingdown != 0 )
{
strcpy(ipaddr,addr->ipaddr);
printf("refused PEER KILLED. slot.%d for %s:%d usock.%d\n",addr->addrind,ipaddr,coin->chain->portp2p,addr->usock);
//printf("refused PEER KILLED. slot.%d for %s:%d usock.%d\n",addr->addrind,ipaddr,coin->chain->portp2p,addr->usock);
iguana_iAkill(coin,addr,1);
}
else
@ -671,7 +671,7 @@ void iguana_startconnection(void *arg)
n++;
iguana_iAconnected(coin,addr);
coin->peers.numconnected++;
printf("%s.PEER CONNECTED.%d:%d of max.%d! %s:%d usock.%d\n",coin->symbol,coin->peers.numconnected,n,coin->MAXPEERS,addr->ipaddr,coin->chain->portp2p,addr->usock);
//printf("%s.PEER CONNECTED.%d:%d of max.%d! %s:%d usock.%d\n",coin->symbol,coin->peers.numconnected,n,coin->MAXPEERS,addr->ipaddr,coin->chain->portp2p,addr->usock);
if ( strcmp("127.0.0.1",addr->ipaddr) == 0 )
coin->peers.localaddr = addr;
else if ( coin->peers.numranked == 0 )

Loading…
Cancel
Save