|
|
@ -60,7 +60,7 @@ int32_t LP_hello(struct LP_forwardinfo *ptr) |
|
|
|
if ( nn_poll(&pfd,1,1) > 0 ) |
|
|
|
{ |
|
|
|
sprintf(msg,"{\"method\":\"hello\",\"from\":\"%s\"}",LP_mypeer != 0 ? LP_mypeer->ipaddr : ""); |
|
|
|
printf("HELLO sent.%d bytes to %s on i.%d\n",LP_send(ptr->pushsock,msg,0),ptr->pushaddr,i); |
|
|
|
//printf("HELLO sent.%d bytes to %s on i.%d\n",LP_send(ptr->pushsock,msg,0),ptr->pushaddr,i);
|
|
|
|
ptr->hello = (uint32_t)time(NULL); |
|
|
|
return(i); |
|
|
|
} |
|
|
@ -120,8 +120,10 @@ char *LP_register(bits256 pubkey,char *ipaddr,uint16_t port) |
|
|
|
{ |
|
|
|
nn_close(ptr->pushsock); |
|
|
|
if ( LP_psockmark(ptr->pushaddr) < 0 ) |
|
|
|
printf("cant mark (%s)\n",ptr->pushaddr); |
|
|
|
printf("recreate pushsock for %s\n",pushaddr); |
|
|
|
{ |
|
|
|
//printf("cant mark (%s)\n",ptr->pushaddr);
|
|
|
|
} |
|
|
|
char str[65]; printf("%u recreate pushsock for %s <- %s\n",(uint32_t)time(NULL),pushaddr,bits256_str(str,pubkey)); |
|
|
|
strcpy(ptr->pushaddr,pushaddr); |
|
|
|
if ( (ptr->pushsock= LP_pushsock_create(ptr,pushaddr)) < 0 ) |
|
|
|
return(clonestr("{\"error\":\"couldnt recreate pushsock\",\"registered\":0}")); |
|
|
|