Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
1b252c7b8b
  1. 4
      iguana/iguana777.c
  2. 2
      iguana/iguana777.h
  3. 30
      iguana/iguana_peers.c
  4. 2
      iguana/main.c

4
iguana/iguana777.c

@ -260,7 +260,7 @@ void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t ti
ptr->timelimit = timelimit;
coin->numbundlesQ++;
//printf("%s bundle.%d[%d] emitfinish.%u\n",coin->symbol,ptr->hdrsi,bp->n,bp->emitfinish);
queue_enqueue("helperQ",&helperQ,&ptr->DL,0);
queue_enqueue("bundlesQ",&bundlesQ,&ptr->DL,0);
}
int32_t iguana_helpertask(FILE *fp,struct OS_memspace *mem,struct OS_memspace *memB,struct iguana_helper *ptr)
@ -323,7 +323,7 @@ void iguana_helper(void *arg)
flag = 0;
if ( (ptr= queue_dequeue(&helperQ,0)) != 0 )
{
if ( (coin= ptr->coin) != 0 && myallocated(0,-1) > coin->MAXMEM && coin->helperdepth > IGUANA_NUMHELPERS/2 && ptr->type == 'B' )
if ( (coin= ptr->coin) != 0 && myallocated(0,-1) > coin->MAXMEM )
queue_enqueue("reQ",&helperQ,&ptr->DL,0);
else
{

2
iguana/iguana777.h

@ -688,6 +688,8 @@ cJSON *iguana_pubkeyjson(struct iguana_info *coin,char *pubkeystr);
void iguana_bundleQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
extern queue_t bundlesQ;
#include "../includes/iguana_api.h"
#endif

30
iguana/iguana_peers.c

@ -982,24 +982,26 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr)
}
}
}
if ( flag == 0 )
{
if ( run++ > 1000 )
{
//printf("sleep\n");
usleep(100000);
}
else if ( addr->rank != 1 )
usleep(coin->polltimeout*100 + 0*(rand() % (coin->polltimeout*100)));
else usleep(100 + coin->polltimeout*1000);
} else run >>= 2;
}
if ( flag != 0 )
run = 0;
else if ( addr->supernet != 0 && time(NULL) > lastping+10 )
else if ( flag == 0 )
{
if ( addr->supernet != 0 && time(NULL) > lastping+10 )
{
iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0);
lastping = (uint32_t)time(NULL);
}
} else run >>= 2;
if ( flag == 0 )//|| addr->rank >= (coin->peers.numranked>>1) )
{
iguana_send_supernet(coin,addr,"{\"agent\":\"SuperNET\",\"method\":\"getpeers\"}",0);
lastping = (uint32_t)time(NULL);
struct iguana_helper *ptr;
if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{
if ( ptr->bp != 0 )
iguana_bundleiters(coin,ptr->bp,ptr->timelimit);
myfree(ptr,ptr->allocsize);
}
}
if ( coin->isRT != 0 && addr->rank > coin->MAXPEERS && (rand() % 100) == 0 )
{

2
iguana/main.c

@ -32,7 +32,7 @@ int32_t USE_JAY,FIRST_EXTERNAL,IGUANA_disableNXT,Debuglevel;
uint32_t prices777_NXTBLOCK,MAX_DEPTH = 100;
char NXTAPIURL[256],IGUANA_NXTADDR[256],IGUANA_NXTACCTSECRET[256];
uint64_t IGUANA_MY64BITS;
queue_t helperQ,jsonQ,finishedQ;
queue_t helperQ,jsonQ,finishedQ,bundlesQ;
static int32_t initflag;
#ifdef __linux__
int32_t IGUANA_NUMHELPERS = 16;

Loading…
Cancel
Save