diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 1b76e220a..b1fd07fe9 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -38,7 +38,7 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping #define LP_MAGICBITS 8 #define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL) -#define LP_AUTOTRADE_TIMEOUT 20 +#define LP_AUTOTRADE_TIMEOUT 30 #define ELECTRUM_TIMEOUT 5 #define LP_ELECTRUM_KEEPALIVE 60 #define LP_ELECTRUM_MAXERRORS 777 diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 62b50d9d2..c36c64d67 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -641,7 +641,7 @@ void prices_loop(void *ctx) } free(retstr); } - sleep(60); + sleep(120); } } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 64719e0d5..6b843316d 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -51,17 +51,6 @@ char *LP_isitme(char *destip,uint16_t destport) } else return(0); } -void LP_peer_request(char *destip,uint16_t destport,cJSON *argjson) -{ - struct LP_peerinfo *peer; uint8_t *msg; int32_t msglen; uint32_t crc32; - peer = LP_peerfind((uint32_t)calc_ipbits(destip),destport); - msg = (void *)jprint(argjson,0); - msglen = (int32_t)strlen((char *)msg) + 1; - crc32 = calc_crc32(0,&msg[2],msglen - 2); - LP_queuesend(crc32,peer->pushsock,"","",msg,msglen); - free_json(argjson); -} - char *issue_LP_psock(char *destip,uint16_t destport,int32_t ispaired) { char url[512],*retstr; @@ -72,18 +61,6 @@ char *issue_LP_psock(char *destip,uint16_t destport,int32_t ispaired) return(retstr); } -void issue_LP_getpeers(char *destip,uint16_t destport) -{ - cJSON *reqjson = cJSON_CreateObject(); - jaddstr(reqjson,"method","getpeers"); - LP_peer_request(destip,destport,reqjson); - /*char url[512],*retstr; - sprintf(url,"http://%s:%u/api/stats/getpeers?ipaddr=%s&port=%u&numpeers=%d",destip,destport,ipaddr,port,numpeers); - retstr = LP_issue_curl("getpeers",destip,port,url); - //printf("%s -> getpeers.(%s)\n",destip,retstr); - return(retstr);*/ -} - char *LP_apicall(struct iguana_info *coin,char *method,char *params) { cJSON *retjson; char *retstr; diff --git a/iguana/exchanges/LP_statemachine.c b/iguana/exchanges/LP_statemachine.c index d518e18c3..e22b7890d 100644 --- a/iguana/exchanges/LP_statemachine.c +++ b/iguana/exchanges/LP_statemachine.c @@ -169,7 +169,28 @@ int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa } return(n); } -void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *myipaddr,uint16_t myport) +void issue_LP_getpeers(char *destip,uint16_t destport) +{ + cJSON *reqjson = cJSON_CreateObject(); + jaddstr(reqjson,"method","getpeers"); + LP_peer_request(destip,destport,reqjson); + /*char url[512],*retstr; + sprintf(url,"http://%s:%u/api/stats/getpeers?ipaddr=%s&port=%u&numpeers=%d",destip,destport,ipaddr,port,numpeers); + retstr = LP_issue_curl("getpeers",destip,port,url); + //printf("%s -> getpeers.(%s)\n",destip,retstr); + return(retstr);*/ +} + +void LP_peer_request(char *destip,uint16_t destport,cJSON *argjson) +{ + struct LP_peerinfo *peer; uint8_t *msg; int32_t msglen; uint32_t crc32; + peer = LP_peerfind((uint32_t)calc_ipbits(destip),destport); + msg = (void *)jprint(argjson,0); + msglen = (int32_t)strlen((char *)msg) + 1; + crc32 = calc_crc32(0,&msg[2],msglen - 2); + LP_queuesend(crc32,peer->pushsock,"","",msg,msglen); + free_json(argjson); +}void LP_peersquery(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *myipaddr,uint16_t myport) { char *retstr; struct LP_peerinfo *peer,*tmp; bits256 zero; uint32_t now,flag = 0; peer = LP_peerfind((uint32_t)calc_ipbits(destipaddr),destport);