|
|
@ -204,7 +204,7 @@ int32_t LP_coinbus(uint16_t coin_busport) |
|
|
|
|
|
|
|
int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipaddr,uint16_t destport,char *retstr,uint32_t now) |
|
|
|
{ |
|
|
|
struct LP_peerinfo *peer; uint32_t argipbits; char *argipaddr; uint16_t argport,pushport,subport; cJSON *array,*item; int32_t i,n=0; |
|
|
|
struct LP_peerinfo *peer; uint32_t argipbits; char *argipaddr; uint16_t argport,pushport,subport; cJSON *array,*item; int32_t numpeers,i,n=0; |
|
|
|
if ( (array= cJSON_Parse(retstr)) != 0 ) |
|
|
|
{ |
|
|
|
if ( (n= cJSON_GetArraySize(array)) > 0 ) |
|
|
@ -221,7 +221,9 @@ int32_t LP_peersparse(struct LP_peerinfo *mypeer,int32_t mypubsock,char *destipa |
|
|
|
argipbits = (uint32_t)calc_ipbits(argipaddr); |
|
|
|
if ( (peer= LP_peerfind(argipbits,argport)) == 0 ) |
|
|
|
{ |
|
|
|
peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session")); |
|
|
|
numpeers = LP_numpeers(); |
|
|
|
if ( IAMLP != 0 || (IAMLP == 0 && numpeers > LP_OPTIONAL_PEERS && (rand() % LP_MAX_PEERS) > numpeers) ) |
|
|
|
peer = LP_addpeer(mypeer,mypubsock,argipaddr,argport,pushport,subport,jint(item,"numpeers"),jint(item,"numutxos"),juint(item,"session")); |
|
|
|
} |
|
|
|
if ( peer != 0 ) |
|
|
|
{ |
|
|
|