From bb580c0b8bd0b1974a618f25446a425a0a8e28bd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Feb 2018 16:29:43 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_peers.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_peers.c b/iguana/exchanges/LP_peers.c index 7f1920280..db09c28d2 100644 --- a/iguana/exchanges/LP_peers.c +++ b/iguana/exchanges/LP_peers.c @@ -59,14 +59,20 @@ char *LP_peers() void LP_cmdchannel(struct LP_peerinfo *peer) { char *hellostr = "{\"method\":\"hello\"}"; - char connectaddr[128],publicaddr[128],*retstr; int32_t pubsock,sentbytes; uint16_t cmdport; + char connectaddr[128],publicaddr[128],*retstr; int32_t i,pubsock,sentbytes=-2; uint16_t cmdport; if ( bits256_nonz(G.LP_mypub25519) == 0 || strcmp(G.USERPASS,"1d8b27b21efabcd96571cd56f91a40fb9aa4cc623d273c63bf9223dc6f8cd81f") == 0 ) return; if ( (cmdport= LP_psock_get(connectaddr,publicaddr,1,1,peer->ipaddr)) != 0 ) { if ( (retstr= _LP_psock_create(&peer->pairsock,&pubsock,peer->ipaddr,cmdport,cmdport,1,1,G.LP_mypub25519)) != 0 ) { - sentbytes = nn_send(peer->pairsock,hellostr,(int32_t)strlen(hellostr)+1,0); + for (i=0; i<30; i++) + { + sentbytes = nn_send(peer->pairsock,hellostr,(int32_t)strlen(hellostr)+1,0); + if ( sentbytes > 0 ) + break; + sleep(1); + } printf("cmdchannel %d created %s sent.%d\n",peer->pairsock,retstr,sentbytes); free(retstr); }