Browse Source
Merge pull request #496 from jl777/spvdex
remove print, improve peer propagation
etomic
jl777
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
5 additions and
5 deletions
-
iguana/exchanges/LP_peers.c
-
iguana/exchanges/LP_signatures.c
-
iguana/exchanges/stats.c
|
@ -212,8 +212,8 @@ void LP_peer_recv(char *ipaddr,int32_t ismine) |
|
|
if ( (peer= LP_peerfind((uint32_t)calc_ipbits(ipaddr),RPC_port)) != 0 ) |
|
|
if ( (peer= LP_peerfind((uint32_t)calc_ipbits(ipaddr),RPC_port)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
peer->numrecv++; |
|
|
peer->numrecv++; |
|
|
if ( ismine != 0 ) |
|
|
//if ( ismine != 0 )
|
|
|
peer->recvtime = (uint32_t)time(NULL); |
|
|
peer->recvtime = (uint32_t)time(NULL); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -262,7 +262,7 @@ uint16_t LP_rarestpeer(char *destip) |
|
|
{ |
|
|
{ |
|
|
HASH_ITER(hh,LP_peerinfos,peer,tmp) |
|
|
HASH_ITER(hh,LP_peerinfos,peer,tmp) |
|
|
{ |
|
|
{ |
|
|
if ( iter == 0 && peer->recvtime < now-3600*24 ) |
|
|
if ( strcmp(peer->ipaddr,LP_myipaddr) != 0 && iter == 0 && peer->recvtime < now-3600 ) |
|
|
continue; |
|
|
continue; |
|
|
if ( peer->isLP != 0 ) |
|
|
if ( peer->isLP != 0 ) |
|
|
{ |
|
|
{ |
|
|
|
@ -611,7 +611,7 @@ char *LP_notify_recv(cJSON *argjson) |
|
|
LP_pubkey_sigcheck(pubp,argjson); |
|
|
LP_pubkey_sigcheck(pubp,argjson); |
|
|
if ( (ipaddr= jstr(argjson,"isLP")) != 0 ) |
|
|
if ( (ipaddr= jstr(argjson,"isLP")) != 0 ) |
|
|
{ |
|
|
{ |
|
|
//printf("notify got isLP %s %d\n",ipaddr,jint(argjson,"ismine"));
|
|
|
printf("notify got isLP %s %d\n",ipaddr,jint(argjson,"ismine")); |
|
|
LP_peer_recv(ipaddr,jint(argjson,"ismine")); |
|
|
LP_peer_recv(ipaddr,jint(argjson,"ismine")); |
|
|
if ( IAMLP != 0 && G.LP_IAMLP == 0 && strcmp(ipaddr,LP_myipaddr) == 0 ) |
|
|
if ( IAMLP != 0 && G.LP_IAMLP == 0 && strcmp(ipaddr,LP_myipaddr) == 0 ) |
|
|
{ |
|
|
{ |
|
|
|
@ -710,7 +710,7 @@ void LP_rpc_processreq(void *_ptr) |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
response = malloc(strlen(retstr)+1024+1+1); |
|
|
response = malloc(strlen(retstr)+1024+1+1); |
|
|
printf("alloc response.%p\n",response); |
|
|
//printf("alloc response.%p\n",response);
|
|
|
} |
|
|
} |
|
|
sprintf(hdrs,"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET, POST\r\nCache-Control : no-cache, no-store, must-revalidate\r\n%sContent-Length : %8d\r\n\r\n",content_type,(int32_t)strlen(retstr)); |
|
|
sprintf(hdrs,"HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nAccess-Control-Allow-Credentials: true\r\nAccess-Control-Allow-Methods: GET, POST\r\nCache-Control : no-cache, no-store, must-revalidate\r\n%sContent-Length : %8d\r\n\r\n",content_type,(int32_t)strlen(retstr)); |
|
|
response[0] = '\0'; |
|
|
response[0] = '\0'; |
|
|