|
@ -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); |
|
|