From 25f2c97c92dc28a8c73ebaa1a32ebadc831c5bd7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 7 Feb 2018 21:39:10 +0200 Subject: [PATCH] LP_blockinit_mutex --- iguana/exchanges/LP_nativeDEX.c | 3 ++- iguana/exchanges/LP_scan.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index eb96e7d93..48104a144 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -85,7 +85,7 @@ void LP_millistats_update(struct LP_millistats *mp) } #include "LP_include.h" -portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex; +portable_mutex_t LP_peermutex,LP_UTXOmutex,LP_utxomutex,LP_commandmutex,LP_cachemutex,LP_swaplistmutex,LP_forwardmutex,LP_pubkeymutex,LP_networkmutex,LP_psockmutex,LP_coinmutex,LP_messagemutex,LP_portfoliomutex,LP_electrummutex,LP_butxomutex,LP_reservedmutex,LP_nanorecvsmutex,LP_tradebotsmutex,LP_gcmutex,LP_inusemutex,LP_cJSONmutex,LP_logmutex,LP_statslogmutex,LP_tradesmutex,LP_commandQmutex,LP_blockinit_mutex; int32_t LP_canbind; char *Broadcaststr,*Reserved_msgs[2][1000]; int32_t num_Reserved_msgs[2],max_Reserved_msgs[2]; @@ -1282,6 +1282,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu portable_mutex_init(&LP_statslogmutex); portable_mutex_init(&LP_tradesmutex); portable_mutex_init(&LP_commandQmutex); + portable_mutex_init(&LP_blockinit_mutex); myipaddr = clonestr("127.0.0.1"); #ifndef _WIN32 #ifndef FROM_JS diff --git a/iguana/exchanges/LP_scan.c b/iguana/exchanges/LP_scan.c index fdb3801cd..a70a1bb44 100644 --- a/iguana/exchanges/LP_scan.c +++ b/iguana/exchanges/LP_scan.c @@ -22,6 +22,7 @@ int32_t LP_blockinit(struct iguana_info *coin,int32_t height) { int32_t i,iter,numtx,checkht=-1; cJSON *blockobj,*txs,*txobj; bits256 txid; struct LP_transaction *tx; + portable_mutex_lock(&LP_blockinit_mutex); if ( (blockobj= LP_blockjson(&checkht,coin->symbol,0,height)) != 0 && checkht == height ) { if ( (txs= jarray(&numtx,blockobj,"tx")) != 0 ) @@ -52,6 +53,7 @@ int32_t LP_blockinit(struct iguana_info *coin,int32_t height) } free_json(blockobj); } + portable_mutex_unlock(&LP_blockinit_mutex); if ( checkht == height ) return(0); else return(-1);