From 9452d23c4de3aeaad7fa4240004eb388a442a403 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Feb 2018 12:40:00 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_network.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_network.c b/iguana/exchanges/LP_network.c index 9a1b7d09f..0a378f52c 100644 --- a/iguana/exchanges/LP_network.c +++ b/iguana/exchanges/LP_network.c @@ -694,13 +694,25 @@ char *_LP_psock_create(int32_t *pullsockp,int32_t *pubsockp,char *ipaddr,uint16_ if ( pubp->pairsock >= 0 ) { printf("warning %s already has pairsock.%d\n",bits256_str(str,pubkey),pubp->pairsock); - /*for (i=0; ipairsock ) { - PSOCKS[i].lasttime = (uint32_t)time(NULL) - PSOCK_KEEPALIVE - 1; - break; - }*/ - return(clonestr("{\"error\":\"need to regen json\"}")); + //PSOCKS[i].lasttime = (uint32_t)time(NULL) - PSOCK_KEEPALIVE - 1; + retjson = cJSON_CreateObject(); + jaddstr(retjson,"result","success"); + jaddstr(retjson,"LPipaddr",ipaddr); + jaddstr(retjson,"connectaddr",PSOCKS[i].sendaddr); + jaddnum(retjson,"connectport",PSOCKS[i].sendport); + jaddnum(retjson,"ispaired",PSOCKS[i].ispaired); + jaddnum(retjson,"cmdchannel",PSOCKS[i].cmdchannel); + jaddstr(retjson,"publicaddr",PSOCKS[i].publicaddr); + jaddnum(retjson,"publicport",PSOCKS[i].publicport); + //printf("cmd.%d publicaddr.(%s) for subaddr.(%s), pullsock.%d pubsock.%d\n",cmdchannel,pushaddr,subaddr,pullsock,pubsock); + *pullsockp = pullsock; + *pubsockp = pubsock; + return(jprint(retjson,1)); + } + LP_psockadd(ispaired,pullsock,publicport,pubsock,subport,subaddr,pushaddr,cmdchannel); } //printf("pairsock for %s <- %d\n",bits256_str(str,pubkey),pullsock); //pubp->pairsock = pullsock;