Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
1270cf9c8d
  1. 2
      deprecated/obsolete.h
  2. 1
      iguana/SuperNET.c
  3. 7
      iguana/iguana777.c
  4. 2
      iguana/iguana777.h
  5. 2
      iguana/iguana_msg.c
  6. 14
      iguana/iguana_recv.c
  7. 13
      iguana/main.c

2
deprecated/obsolete.h

@ -10309,7 +10309,7 @@ void iguana_dedicatedrecv(void *arg)
if ( (agent->sock= iguana_socket(0,hostname,port)) < 0 )
return(clonestr("{\"result\":\"agent added, but couldnt connect to remote agent\"}"));
}
sprintf(retbuf,"{\"result\":\"agent added\",\"name\"\"%s\",\"methods\":%s,\"hostname\":\"%s\",\"port\":%u,\"sock\":%d}",agent->name,jprint(agent->methods,0),agent->hostname,agent->port,agent->sock);
sprintf(retbuf,"{\"result\":\"agent added\",\"name\":\"%s\",\"methods\":%s,\"hostname\":\"%s\",\"port\":%u,\"sock\":%d}",agent->name,jprint(agent->methods,0),agent->hostname,agent->port,agent->sock);
return(clonestr(retbuf));
}
}

1
iguana/SuperNET.c

@ -661,7 +661,6 @@ void SuperNET_init(void *args)
else free(ipaddr), ipaddr = 0;
}
#endif
//return;
sendtimeout = 100;
recvtimeout = 30000;
PNACL_message("call PUBpoint myinfo.%p\n",myinfo);

7
iguana/iguana777.c

@ -339,13 +339,12 @@ void iguana_helper(void *arg)
if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{
if ( ptr->bp != 0 && ptr->coin != 0 )
iguana_bundleiters(ptr->coin,ptr->bp,ptr->timelimit);
flag += iguana_bundleiters(ptr->coin,ptr->bp,ptr->timelimit);
myfree(ptr,ptr->allocsize);
flag++;
}
}
//if ( flag == 0 )
usleep(100000);
if ( flag == 0 )
sleep(10);
}
}

2
iguana/iguana777.h

@ -686,7 +686,7 @@ int32_t is_bitcoinrpc(char *method);
char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,char *remoteaddr);
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);
int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit);
void ramcoder_test(void *data,int64_t len);
void SuperNET_init(void *args);
char *SuperNET_parser(struct supernet_info *myinfo,char *agent,char *method,cJSON *json,char *remoteaddr);

2
iguana/iguana_msg.c

@ -439,7 +439,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
}
retval = 0;
//usleep(1000);
//printf("iguana_msgparser %s parse.(%s)\n",addr->ipaddr,H->command);
printf("iguana_msgparser %s parse.(%s)\n",addr->ipaddr,H->command);
if ( strcmp(H->command,"SuperNET") == 0 )
{
addr->supernet = 1;

14
iguana/iguana_recv.c

@ -334,7 +334,7 @@ void iguana_bundlespeculate(struct iguana_info *coin,struct iguana_bundle *bp,in
} //else printf("speculative.%p %d vs %d cmp.%d\n",bp->speculative,bundlei,bp->numspec,bp->speculative!=0?memcmp(hash2.bytes,bp->speculative[bundlei].bytes,sizeof(hash2)):-1);
}
void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit)
int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit)
{
int32_t i,n,valid,pend,max,counter = 0; uint32_t now; struct iguana_block *block; double endmillis;
coin->numbundlesQ--;
@ -357,21 +357,20 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
}
sleep(1);
iguana_bundleQ(coin,bp,bp->n * 10);
return;
return(0);
}
pend = queue_size(&coin->priorityQ) + queue_size(&coin->blocksQ);
for (i=0; i<IGUANA_MAXPEERS; i++)
pend += coin->peers.active[i].pendblocks;
if ( pend >= coin->MAXPENDING*coin->MAXPEERS )
{
usleep(10000);
sleep(10000);
printf("SKIP pend.%d vs %d: ITERATE bundle.%d n.%d r.%d s.%d finished.%d timelimit.%d\n",pend,coin->MAXPENDING*coin->MAXPEERS,bp->bundleheight,bp->n,bp->numrecv,bp->numsaved,bp->emitfinish,timelimit);
iguana_bundleQ(coin,bp,counter == 0 ? bp->n*5 : bp->n*2);
return;
return(0);
}
max = 1 + ((coin->MAXPENDING*coin->MAXPEERS - pend) >> 1);
endmillis = OS_milliseconds() + timelimit;
// memset(bp->issued,0,sizeof(bp->issued));
while ( bp->emitfinish == 0 && OS_milliseconds() < endmillis )
{
now = (uint32_t)time(NULL);
@ -418,7 +417,7 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
bp->issued[i] = 0;
iguana_blockQ(coin,bp,i,block->RO.hash2,0);
iguana_bundleQ(coin,bp,counter == 0 ? bp->n*5 : bp->n*2);
return;
return(0);
}
} else printf("error getting block (%d:%d) %p vs %p\n",bp->hdrsi,i,block,iguana_blockfind(coin,bp->hashes[i]));
}
@ -427,10 +426,11 @@ void iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_
bp->emitfinish = 1;
sleep(1);
iguana_emitQ(coin,bp);
return;
return(1);
}
iguana_bundleQ(coin,bp,counter == 0 ? bp->n*5 : bp->n*2);
}
return(0);
}
// main context, ie single threaded

13
iguana/main.c

@ -35,9 +35,9 @@ uint64_t IGUANA_MY64BITS;
queue_t helperQ,jsonQ,finishedQ,bundlesQ;
static int32_t initflag;
#ifdef __linux__
int32_t IGUANA_NUMHELPERS = 16;
#else
int32_t IGUANA_NUMHELPERS = 8;
#else
int32_t IGUANA_NUMHELPERS = 1;
#endif
char *SuperNET_jsonstr(struct supernet_info *myinfo,char *jsonstr,char *remoteaddr)
@ -236,12 +236,12 @@ void iguana_main(void *arg)
iguana_launch(iguana_coinadd("BTCD"),"rpcloop",iguana_rpcloop,iguana_coinadd("BTCD"),IGUANA_PERMTHREAD);
if ( coinargs != 0 )
iguana_launch(iguana_coinadd("BTCD"),"iguana_coins",iguana_coins,coinargs,IGUANA_PERMTHREAD);
else if ( 0 )
else if ( 1 )
{
#ifdef __APPLE__
sleep(1);
char *str;
if ( (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":2,\"coin\":\"BTCD\",\"active\":1}"),0)) != 0 )
if ( (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":0,\"maxpeers\":2,\"activecoin\":\"BTC\",\"active\":1}"),0)) != 0 )
{
printf("got.(%s)\n",str);
free(str);
@ -264,13 +264,12 @@ void iguana_main(void *arg)
if ( (ptr= queue_dequeue(&bundlesQ,0)) != 0 )
{
if ( ptr->bp != 0 && ptr->coin != 0 )
iguana_bundleiters(ptr->coin,ptr->bp,ptr->timelimit);
flag += iguana_bundleiters(ptr->coin,ptr->bp,ptr->timelimit);
myfree(ptr,ptr->allocsize);
flag++;
}
}
if ( flag == 0 )
usleep(100000);
sleep(1);
}
}

Loading…
Cancel
Save