From ae9be1f4d8e82b3ab692e42fa521fcd6312f2f26 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 18 Jun 2017 13:54:43 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_forwarding.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/iguana/exchanges/LP_forwarding.c b/iguana/exchanges/LP_forwarding.c index 3ded921fd..fac22d1f0 100644 --- a/iguana/exchanges/LP_forwarding.c +++ b/iguana/exchanges/LP_forwarding.c @@ -51,20 +51,24 @@ char *LP_lookup(bits256 pubkey) int32_t LP_hello(struct LP_forwardinfo *ptr) { int32_t i,n=10; char msg[512]; struct nn_pollfd pfd; - pfd.fd = ptr->pushsock; - pfd.events = NN_POLLOUT; - for (i=0; ipubkey,LP_mypubkey) != 0 ) { - if ( nn_poll(&pfd,1,1) > 0 ) + pfd.fd = ptr->pushsock; + pfd.events = NN_POLLOUT; + for (i=0; iipaddr : ""); - 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); + 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); + ptr->hello = (uint32_t)time(NULL); + return(i); + } } + printf("%d iterations on nn_poll and %s pushsock still not ready\n",i,ptr->pushaddr); + return(-1); } - printf("%d iterations on nn_poll and %s pushsock still not ready\n",i,ptr->pushaddr); - return(-1); + return(0); } int32_t LP_hellos()