Browse Source

Test

etomic
jl777 7 years ago
parent
commit
3e004c6397
  1. 2
      iguana/exchanges/LP_include.h
  2. 26
      iguana/exchanges/LP_nativeDEX.c
  3. 3
      iguana/exchanges/LP_network.c
  4. 4
      iguana/exchanges/LP_signatures.c

2
iguana/exchanges/LP_include.h

@ -54,7 +54,7 @@ void emscripten_usleep(int32_t x); // returns immediate, no sense for sleeping
#define DPOW_MIN_ASSETCHAIN_SIGS 11 #define DPOW_MIN_ASSETCHAIN_SIGS 11
#define LP_ENCRYPTED_MAXSIZE (4096 + 2 + crypto_box_NONCEBYTES + crypto_box_ZEROBYTES) #define LP_ENCRYPTED_MAXSIZE (4096 + 2 + crypto_box_NONCEBYTES + crypto_box_ZEROBYTES)
#define LP_MAXPUBKEY_ERRORS 3 #define LP_MAXPUBKEY_ERRORS 10
#define PSOCK_KEEPALIVE 3600 #define PSOCK_KEEPALIVE 3600
#define MAINLOOP_PERSEC 100 #define MAINLOOP_PERSEC 100
#define MAX_PSOCK_PORT 60000 #define MAX_PSOCK_PORT 60000

26
iguana/exchanges/LP_nativeDEX.c

@ -33,6 +33,32 @@ struct LP_peerinfo *LP_peerinfos,*LP_mypeer;
struct LP_forwardinfo *LP_forwardinfos; struct LP_forwardinfo *LP_forwardinfos;
struct iguana_info *LP_coins; struct iguana_info *LP_coins;
struct LP_pubkeyinfo *LP_pubkeyinfos; struct LP_pubkeyinfo *LP_pubkeyinfos;
struct LP_millistats
{
double lastmilli,millisum,threshold;
uint32_t count;
char name[64];
} LP_psockloop_stats,LP_reserved_msgs_stats,utxosQ_loop_stats,stats_rpcloop_stats,command_rpcloop_stats,queue_loop_stats,prices_loop_stats,LP_coinsloop_stats,LP_coinsloop_statsBTC,LP_coinsloop_statsKMD,LP_pubkeysloop_stats,LP_privkeysloop_stats,LP_swapsloop_stats;
void LP_millistats_update(struct LP_millistats *mp)
{
double elapsed,millis;
if ( mp->lastmilli == 0. )
mp->lastmilli = OS_milliseconds();
else
{
mp->count++;
millis = OS_milliseconds();
elapsed = (millis - mp->lastmilli);
mp->millisum += elapsed;
if ( mp->threshold != 0. && elapsed > mp->threshold )
{
printf("%s elapsed %.3f millis > threshold %.3f, ave %.3f millis, count.%u\n",mp->name,elapsed,mp->threshold,mp->millisum/mp->count,mp->count);
}
}
}
#include "LP_network.c" #include "LP_network.c"
char *activecoins[] = { "BTC", "KMD" }; char *activecoins[] = { "BTC", "KMD" };

3
iguana/exchanges/LP_network.c

@ -474,8 +474,11 @@ void LP_psockloop(void *_ptr) // printouts seem to be needed for forwarding to w
{ {
static struct nn_pollfd *pfds; static struct nn_pollfd *pfds;
int32_t i,n,nonz,iter,retval,sentbytes,size=0,sendsock = -1; uint32_t now; struct psock *ptr=0; void *buf=0; char keepalive[512]; int32_t i,n,nonz,iter,retval,sentbytes,size=0,sendsock = -1; uint32_t now; struct psock *ptr=0; void *buf=0; char keepalive[512];
strcpy(LP_psockloop_stats.name,"LP_psockloop");
LP_psockloop_stats.threshold = 100.;
while ( 1 ) while ( 1 )
{ {
LP_millistats_update(&LP_psockloop_stats);
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
if ( buf != 0 && ptr != 0 && sendsock >= 0 ) if ( buf != 0 && ptr != 0 && sendsock >= 0 )
{ {

4
iguana/exchanges/LP_signatures.c

@ -286,11 +286,11 @@ int32_t LP_utxos_sigcheck(uint32_t timestamp,char *sigstr,char *pubsecpstr,bits2
if ( memcmp(pub33,pubsecp,33) != 0 || retval != 0 ) if ( memcmp(pub33,pubsecp,33) != 0 || retval != 0 )
{ {
static uint32_t counter; static uint32_t counter;
if ( counter++ < 10 ) if ( counter++ <= LP_MAXPUBKEY_ERRORS )
{ {
if ( pubp != 0 ) if ( pubp != 0 )
pubp->numerrors++; pubp->numerrors++;
if ( pubp != 0 && pubp->numerrors > 1 ) if ( pubp != 0 && pubp->numerrors > LP_MAXPUBKEY_ERRORS/2 )
printf("LP_utxos_sigcheck failure.%d, probably from %s with older version\n",pubp!=0?pubp->numerrors:-1,bits256_str(str,pubkey)); printf("LP_utxos_sigcheck failure.%d, probably from %s with older version\n",pubp!=0?pubp->numerrors:-1,bits256_str(str,pubkey));
} }
retval = -1; retval = -1;

Loading…
Cancel
Save