Browse Source

Test

etomic
jl777 7 years ago
parent
commit
19adc5d25d
  1. 8
      iguana/exchanges/LP_nativeDEX.c
  2. 2
      iguana/exchanges/LP_remember.c

8
iguana/exchanges/LP_nativeDEX.c

@ -165,6 +165,7 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
if ( duplicate != 0 ) if ( duplicate != 0 )
dup++; dup++;
else uniq++; else uniq++;
portable_mutex_lock(&LP_commandmutex);
if ( (rand() % 10000) == 0 ) if ( (rand() % 10000) == 0 )
printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff); printf("%s dup.%d (%u / %u) %.1f%% encrypted.%d recv.%u [%02x %02x] vs %02x %02x\n",typestr,duplicate,dup,dup+uniq,(double)100*dup/(dup+uniq),encrypted,crc32,ptr[0],ptr[1],crc32&0xff,(crc32>>8)&0xff);
if ( duplicate == 0 ) if ( duplicate == 0 )
@ -245,17 +246,16 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
} }
else else
{ {
portable_mutex_lock(&LP_commandmutex);
if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 ) if ( (retstr= LP_command_process(ctx,myipaddr,pubsock,argjson,&((uint8_t *)ptr)[len],recvlen - len)) != 0 )
{ {
} }
portable_mutex_unlock(&LP_commandmutex);
//printf("%.3f %s LP_command_process\n",OS_milliseconds()-millis,jstr(argjson,"method")); //printf("%.3f %s LP_command_process\n",OS_milliseconds()-millis,jstr(argjson,"method"));
} }
free_json(argjson); free_json(argjson);
} }
} }
} //else printf("DUPLICATE.(%s)\n",(char *)ptr); } //else printf("DUPLICATE.(%s)\n",(char *)ptr);
portable_mutex_unlock(&LP_commandmutex);
if ( jsonstr != 0 && (void *)jsonstr != (void *)ptr && encrypted == 0 ) if ( jsonstr != 0 && (void *)jsonstr != (void *)ptr && encrypted == 0 )
free(jsonstr); free(jsonstr);
if ( ptr != 0 ) if ( ptr != 0 )
@ -322,13 +322,13 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int
{ {
if ( jobj(argjson,"method") != 0 && strcmp("connect",jstr(argjson,"method")) == 0 ) if ( jobj(argjson,"method") != 0 && strcmp("connect",jstr(argjson,"method")) == 0 )
printf("self.(%s)\n",str); printf("self.(%s)\n",str);
portable_mutex_lock(&LP_commandmutex);
if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 ) if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 )
{ {
portable_mutex_lock(&LP_commandmutex);
if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 ) if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 )
free(retstr); free(retstr);
portable_mutex_unlock(&LP_commandmutex);
} }
portable_mutex_unlock(&LP_commandmutex);
free_json(argjson); free_json(argjson);
} }
free(str); free(str);

2
iguana/exchanges/LP_remember.c

@ -839,7 +839,7 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
srcAdest = srcBdest = destAdest = destBdest = 0; srcAdest = srcBdest = destAdest = destBdest = 0;
if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 ) if ( rswap.bobcoin[0] == 0 || rswap.alicecoin[0] == 0 || strcmp(rswap.bobcoin,rswap.src) != 0 || strcmp(rswap.alicecoin,rswap.dest) != 0 )
{ {
printf("legacy DB SWAPS files BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest); printf("legacy DB SWAPS.(%u %u) %llu files BOB.(%s) Alice.(%s) src.(%s) dest.(%s)\n",rswap.requestid,rswap.quoteid,(long long)rswap.aliceid,rswap.bobcoin,rswap.alicecoin,rswap.src,rswap.dest);
return(cJSON_Parse("{\"error\":\"mismatched bob/alice vs src/dest coins??\"}")); return(cJSON_Parse("{\"error\":\"mismatched bob/alice vs src/dest coins??\"}"));
} }
alice = LP_coinfind(rswap.alicecoin); alice = LP_coinfind(rswap.alicecoin);

Loading…
Cancel
Save