Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6206c267c7
  1. 8
      crypto777/iguana_utils.c
  2. 4
      iguana/iguana_exchanges.c

8
crypto777/iguana_utils.c

@ -228,7 +228,8 @@ void iguana_launcher(void *ptr)
struct iguana_thread *t = ptr; struct iguana_info *coin; struct iguana_thread *t = ptr; struct iguana_info *coin;
coin = t->coin; coin = t->coin;
t->funcp(t->arg); t->funcp(t->arg);
coin->Terminated[t->type % (sizeof(coin->Terminated)/sizeof(*coin->Terminated))]++; if ( coin != 0 )
coin->Terminated[t->type % (sizeof(coin->Terminated)/sizeof(*coin->Terminated))]++;
queue_enqueue("TerminateQ",&TerminateQ,&t->DL,0); queue_enqueue("TerminateQ",&TerminateQ,&t->DL,0);
} }
@ -250,13 +251,14 @@ struct iguana_thread *iguana_launch(struct iguana_info *coin,char *name,iguana_f
t->funcp = funcp; t->funcp = funcp;
t->arg = arg; t->arg = arg;
t->type = (type % (sizeof(coin->Terminated)/sizeof(*coin->Terminated))); t->type = (type % (sizeof(coin->Terminated)/sizeof(*coin->Terminated)));
coin->Launched[t->type]++; if ( coin != 0 )
coin->Launched[t->type]++;
retval = OS_thread_create(&t->handle,NULL,(void *)iguana_launcher,(void *)t); retval = OS_thread_create(&t->handle,NULL,(void *)iguana_launcher,(void *)t);
if ( retval != 0 ) if ( retval != 0 )
printf("error launching %s\n",t->name); printf("error launching %s\n",t->name);
while ( (t= queue_dequeue(&TerminateQ,0)) != 0 ) while ( (t= queue_dequeue(&TerminateQ,0)) != 0 )
{ {
if ( (rand() % 100000) == 0 ) if ( (rand() % 100000) == 0 && coin != 0 )
printf("terminated.%d launched.%d terminate.%p\n",coin->Terminated[t->type],coin->Launched[t->type],t); printf("terminated.%d launched.%d terminate.%p\n",coin->Terminated[t->type],coin->Launched[t->type],t);
iguana_terminate(coin,t); iguana_terminate(coin,t);
} }

4
iguana/iguana_exchanges.c

@ -907,9 +907,9 @@ struct exchange_info *exchange_create(char *exchangestr,cJSON *argjson)
safecopy(exchange->tradepassword,tradepassword,sizeof(exchange->tradepassword)); safecopy(exchange->tradepassword,tradepassword,sizeof(exchange->tradepassword));
if ( (exchange->commission= jdouble(argjson,"commission")) > 0. ) if ( (exchange->commission= jdouble(argjson,"commission")) > 0. )
exchange->commission *= .01; exchange->commission *= .01;
printf("ADDEXCHANGE.(%s) [%s, %s, %s] commission %.3f%%\n",exchangestr,exchange->apikey,exchange->userid,exchange->apisecret,exchange->commission * 100.); printf("ADDEXCHANGE.(%s) [%s, %s, %s] commission %.3f%% -> exchangeid.%d\n",exchangestr,exchange->apikey,exchange->userid,exchange->apisecret,exchange->commission * 100.,exchangeid);
Exchanges[exchangeid] = exchange; Exchanges[exchangeid] = exchange;
iguana_launch(iguana_coinadd("BTCD",0),"exchangeloop",(void *)exchanges777_loop,exchange,IGUANA_EXCHANGETHREAD); iguana_launch(0,"exchangeloop",(void *)exchanges777_loop,exchange,IGUANA_EXCHANGETHREAD);
return(exchange); return(exchange);
} }

Loading…
Cancel
Save