Browse Source

Test

etomic
jl777 8 years ago
parent
commit
8cd0439c29
  1. 12
      iguana/exchanges/LP_forwarding.c

12
iguana/exchanges/LP_forwarding.c

@ -298,7 +298,7 @@ char *LP_forwardhex(void *ctx,int32_t pubsock,bits256 pubkey,char *hexstr)
int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,double profitmargin,bits256 pubkey,char *jsonstr,int32_t freeflag) int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,double profitmargin,bits256 pubkey,char *jsonstr,int32_t freeflag)
{ {
struct LP_forwardinfo *ptr; struct LP_peerinfo *peer,*tmp; char *msg,*hexstr,*retstr; int32_t len,n=0,mlen; cJSON *retjson,*reqjson,*argjson; struct LP_forwardinfo *ptr; struct LP_peerinfo *peer,*tmp; char *msg,*hexstr,*retstr; int32_t len,n=0,mlen; cJSON *reqjson,*argjson;
if ( jsonstr == 0 || jsonstr[0] == 0 ) if ( jsonstr == 0 || jsonstr[0] == 0 )
return(-1); return(-1);
len = (int32_t)strlen(jsonstr) + 1; len = (int32_t)strlen(jsonstr) + 1;
@ -340,13 +340,9 @@ int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,double profitmargin,
mlen = (int32_t)strlen(msg) + 1; mlen = (int32_t)strlen(msg) + 1;
HASH_ITER(hh,LP_peerinfos,peer,tmp) HASH_ITER(hh,LP_peerinfos,peer,tmp)
{ {
if ( (retjson= cJSON_Parse(retstr)) != 0 ) //printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg);
{ if ( LP_send(peer->pushsock,msg,mlen,0) == mlen )
//printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg); n++;
if ( LP_send(peer->pushsock,msg,mlen,0) == mlen )
n++;
free_json(retjson);
}
if ( n >= 8 )//sizeof(default_LPnodes)/sizeof(*default_LPnodes) ) if ( n >= 8 )//sizeof(default_LPnodes)/sizeof(*default_LPnodes) )
break; break;
} }

Loading…
Cancel
Save