|
|
@ -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); |
|
|
|