Browse Source

Test

etomic
jl777 8 years ago
parent
commit
ad2cda6aaa
  1. 2
      crypto777/bitcoind_RPC.c
  2. 1
      iguana/exchanges/LP_include.h
  3. 5
      iguana/exchanges/LP_peers.c
  4. 24
      iguana/exchanges/LP_rpc.c
  5. 3
      iguana/exchanges/LP_utxos.c

2
crypto777/bitcoind_RPC.c

@ -202,7 +202,7 @@ try_again:
if ( res != CURLE_OK )
{
numretries++;
if ( specialcase != 0 )
if ( specialcase != 0 || timeout != 0 )
{
printf("<<<<<<<<<<< bitcoind_RPC.(%s): BTCD.%s timeout params.(%s) s.ptr.(%s) err.%d\n",url,command,params,s.ptr,res);
free(s.ptr);

1
iguana/exchanges/LP_include.h

@ -222,6 +222,7 @@ void LP_quotesinit(char *base,char *rel);
int32_t LP_forward(bits256 pubkey,char *jsonstr,int32_t freeflag);
int32_t LP_ismine(struct LP_utxoinfo *utxo);
int32_t LP_isavailable(struct LP_utxoinfo *utxo);
struct LP_peerinfo *LP_peerfind(uint32_t ipbits,uint16_t port);
#endif

5
iguana/exchanges/LP_peers.c

@ -156,8 +156,6 @@ void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr
{
char *retstr; struct LP_peerinfo *peer,*tmp; uint32_t now,flag = 0;
peer = LP_peerfind((uint32_t)calc_ipbits(destipaddr),destport);
if ( peer != 0 && peer->errors > 0 )
return;
if ( (retstr= issue_LP_getpeers(destipaddr,destport,myipaddr,myport,myprofit,mypeer!=0?mypeer->numpeers:0,mypeer!=0?mypeer->numutxos:0)) != 0 )
{
//printf("got.(%s)\n",retstr);
@ -179,6 +177,5 @@ void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr
if ( flag != 0 )
printf(" <- missing peers\n");
}
} else if ( peer != 0 )
peer->errors++;
}
}

24
iguana/exchanges/LP_rpc.c

@ -17,14 +17,28 @@
// LP_rpc.c
// marketmaker
//
char *LP_issue_curl(char *debugstr,char *destip,uint16_t port,char *url)
{
char *retstr = 0; struct LP_peerinfo *peer = 0;
peer = LP_peerfind((uint32_t)calc_ipbits(destip),port);
if ( peer == 0 || peer->errors < 3 )
{
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) == 0 )
{
if ( peer != 0 )
peer->errors++;
else printf("%s error on (%s:%u) without peer\n",debugstr,destip,port);
}
}
return(retstr);
}
char *issue_LP_getpeers(char *destip,uint16_t destport,char *ipaddr,uint16_t port,double profitmargin,int32_t numpeers,int32_t numutxos)
{
char url[512],*retstr;
char url[512];
sprintf(url,"http://%s:%u/api/stats/getpeers?ipaddr=%s&port=%u&profit=%.6f&numpeers=%d&numutxos=%d",destip,destport,ipaddr,port,profitmargin,numpeers,numutxos);
//printf("send.(%s)\n",url);
retstr = issue_curlt(url,LP_HTTP_TIMEOUT);
//printf("GETPEERS.(%s)\n",retstr);
return(retstr);
return(LP_issue_curl("getpeers",destip,port,url));
}
char *issue_LP_getutxos(char *destip,uint16_t destport,char *coin,int32_t lastn,char *ipaddr,uint16_t port,double profitmargin,int32_t numpeers,int32_t numutxos)

3
iguana/exchanges/LP_utxos.c

@ -501,8 +501,7 @@ void LP_utxosquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr
}
if ( flag != 0 )
printf(" <- missing utxos\n");*/
} else if ( peer != 0 )
peer->errors++;
}
}
cJSON *LP_inventory(char *symbol,int32_t iambob)

Loading…
Cancel
Save