From c58b04ab12fdcb56048458c7f9f03cb1fa1ec599 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 20 Jun 2017 13:00:31 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 7e2ed4b87..1afb731f5 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -158,9 +158,9 @@ int32_t LP_pullsock_check(char **retstrp,char *myipaddr,int32_t pubsock,int32_t { void *ptr; int32_t recvlen=-1,nonz = 0; *retstrp = 0; - while ( pullsock >= 0 ) + if ( pullsock >= 0 ) { - if ( (recvlen= nn_recv(pullsock,&ptr,NN_MSG,0)) >= 0 ) + while ( (recvlen= nn_recv(pullsock,&ptr,NN_MSG,0)) >= 0 ) { nonz++; *retstrp = LP_process_message("PULL",myipaddr,pubsock,profitmargin,ptr,recvlen,pullsock); @@ -173,11 +173,14 @@ int32_t LP_pullsock_check(char **retstrp,char *myipaddr,int32_t pubsock,int32_t int32_t LP_subsock_check(char *myipaddr,int32_t pubsock,int32_t sock,double profitmargin) { int32_t recvlen,nonz = 0; void *ptr; char *retstr; - while ( sock >= 0 && (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) >= 0 ) + if ( sock >= 0 ) { - nonz++; - if ( (retstr= LP_process_message("SUB",myipaddr,pubsock,profitmargin,ptr,recvlen,sock)) != 0 ) - free(retstr); + while ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) >= 0 ) + { + nonz++; + if ( (retstr= LP_process_message("SUB",myipaddr,pubsock,profitmargin,ptr,recvlen,sock)) != 0 ) + free(retstr); + } } return(nonz); }