Browse Source

Test

etomic
jl777 7 years ago
parent
commit
3abc82bbef
  1. 2
      iguana/exchanges/LP_nativeDEX.c
  2. 1
      iguana/exchanges/LP_rpc.c
  3. 22
      iguana/exchanges/stats.c

2
iguana/exchanges/LP_nativeDEX.c

@ -342,7 +342,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int
free_json(recvjson); free_json(recvjson);
} }
} }
int32_t validreq = 1; int32_t validreq = 0;
if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen ) if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen )
{ {
if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 ) if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 )

1
iguana/exchanges/LP_rpc.c

@ -25,6 +25,7 @@ char *LP_issue_curl(char *debugstr,char *destip,uint16_t port,char *url)
maxerrs = LP_MAXPEER_ERRORS; maxerrs = LP_MAXPEER_ERRORS;
if ( peer == 0 || (peer->errors < maxerrs || peer->good >= LP_MINPEER_GOOD) ) if ( peer == 0 || (peer->errors < maxerrs || peer->good >= LP_MINPEER_GOOD) )
{ {
printf("issue.(%s)\n",url);
if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) == 0 ) if ( (retstr= issue_curlt(url,LP_HTTP_TIMEOUT)) == 0 )
{ {
if ( peer != 0 ) if ( peer != 0 )

22
iguana/exchanges/stats.c

@ -732,29 +732,33 @@ void LP_rpc_processreq(void *_ptr)
void stats_rpcloop(void *args) void stats_rpcloop(void *args)
{ {
uint16_t port; int32_t sock,bindsock; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; void *arg64ptr; uint16_t port; int32_t sock,bindsock=-1; socklen_t clilen; struct sockaddr_in cli_addr; uint32_t ipbits; uint64_t arg64; void *arg64ptr;
if ( (port= *(uint16_t *)args) == 0 ) if ( (port= *(uint16_t *)args) == 0 )
port = 7779; port = 7779;
RPC_port = port; RPC_port = port;
while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) /*while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 )
{ {
//if ( coin->MAXPEERS == 1 ) //if ( coin->MAXPEERS == 1 )
// break; // break;
//exit(-1); //exit(-1);
sleep(3); sleep(3);
} }
printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock); printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock);*/
while ( bindsock >= 0 ) while ( 1 )
{
if ( bindsock < 0 )
{ {
while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 )
sleep(3);
printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock);
}
clilen = sizeof(cli_addr); clilen = sizeof(cli_addr);
sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen); sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen);
if ( sock < 0 ) if ( sock < 0 )
{ {
printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno)); printf("iguana_rpcloop ERROR on accept usock.%d errno %d %s\n",sock,errno,strerror(errno));
close(bindsock); close(bindsock);
while ( (bindsock= iguana_socket(1,"0.0.0.0",port)) < 0 ) bindsock = -1;
sleep(3);
printf(">>>>>>>>>> DEX stats 127.0.0.1:%d bind sock.%d DEX stats API enabled <<<<<<<<<\n",port,bindsock);
continue; continue;
} }
memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits)); memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits));
@ -773,9 +777,11 @@ void stats_rpcloop(void *args)
else if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 ) else if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_rpc_processreq,arg64ptr) != 0 )
{ {
printf("error launching rpc handler on port %d\n",port); printf("error launching rpc handler on port %d\n",port);
}
// yes, small leak per command // yes, small leak per command
} }
close(bindsock);
bindsock = -1;
}
} }
#ifndef FROM_MARKETMAKER #ifndef FROM_MARKETMAKER

Loading…
Cancel
Save