|
|
@ -57,7 +57,7 @@ char *LP_peers() |
|
|
|
struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char *ipaddr,uint16_t port,uint16_t pushport,uint16_t subport,int32_t numpeers,int32_t numutxos,uint32_t sessionid) |
|
|
|
{ |
|
|
|
uint32_t ipbits; int32_t pushsock,subsock,timeout; char checkip[64],pushaddr[64],subaddr[64]; struct LP_peerinfo *peer = 0; |
|
|
|
printf("addpeer (%s:%u)\n",ipaddr,port); |
|
|
|
printf("addpeer (%s:%u) pushport.%u subport.%u\n",ipaddr,port,pushport,subport); |
|
|
|
#ifdef LP_STRICTPEERS |
|
|
|
if ( strncmp("5.9.253",ipaddr,strlen("5.9.253")) != 0 ) |
|
|
|
return(0); |
|
|
@ -87,8 +87,6 @@ struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char |
|
|
|
peer->ipbits = ipbits; |
|
|
|
peer->port = port; |
|
|
|
peer->ip_port = ((uint64_t)port << 32) | ipbits; |
|
|
|
printf("allocated peer\n"); |
|
|
|
#ifndef FROM_JS |
|
|
|
if ( pushport != 0 && subport != 0 && (pushsock= nn_socket(AF_SP,NN_PUSH)) >= 0 ) |
|
|
|
{ |
|
|
|
nanomsg_transportname(0,pushaddr,peer->ipaddr,pushport); |
|
|
@ -120,7 +118,6 @@ struct LP_peerinfo *LP_addpeer(struct LP_peerinfo *mypeer,int32_t mypubsock,char |
|
|
|
printf("error connecting to push.(%s)\n",pushaddr); |
|
|
|
} |
|
|
|
} else printf("%s pushport.%u subport.%u pushsock.%d\n",ipaddr,pushport,subport,pushsock); |
|
|
|
#endif |
|
|
|
if ( peer->pushsock >= 0 && peer->subsock >= 0 ) |
|
|
|
{ |
|
|
|
portable_mutex_lock(&LP_peermutex); |
|
|
|