From 7bef8b3116a10004f86a803e3d4340d6aa8b9956 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 6 Apr 2016 00:15:01 -0500 Subject: [PATCH] test --- crypto777/OS_portable.h | 5 +++++ iguana/SuperNET.h | 2 ++ iguana/iguana777.h | 2 ++ iguana/iguana_unspents.c | 2 +- iguana/main.c | 25 ++++++++++++++++++++++++- iguana/peggy.h | 2 ++ 6 files changed, 36 insertions(+), 2 deletions(-) diff --git a/crypto777/OS_portable.h b/crypto777/OS_portable.h index 2a23a19cb..c5c3fb4fe 100755 --- a/crypto777/OS_portable.h +++ b/crypto777/OS_portable.h @@ -62,6 +62,11 @@ #define MAP_FILE 0 #endif +#define fopen myfopen +#define fclose myfclose +FILE *myfopen(char *fname,char *mode); +int32_t myfclose(FILE *fp); + struct huffstream { uint8_t *ptr,*buf; uint32_t bitoffset,maski,endpos; uint32_t allocsize:31,allocated:1; }; typedef struct huffstream HUFF; diff --git a/iguana/SuperNET.h b/iguana/SuperNET.h index b7b8e6082..51e0ae398 100755 --- a/iguana/SuperNET.h +++ b/iguana/SuperNET.h @@ -201,6 +201,8 @@ struct supernet_info *SuperNET_MYINFOfind(int32_t *nump,bits256 pubkey); void SuperNET_MYINFOadd(struct supernet_info *myinfo); struct supernet_info *SuperNET_accountfind(cJSON *argjson); int32_t SuperNET_MYINFOS(struct supernet_info **myinfos,int32_t max); +FILE *myfopen(char *fname,char *mode); +int32_t myfclose(FILE *fp); #endif diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 5708ae47e..b12726d20 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -849,6 +849,8 @@ void iguana_convertQ(struct iguana_info *coin,struct iguana_bundle *bp); void iguana_convert(struct iguana_info *coin,struct iguana_bundle *bp);//,struct iguana_ramchain *ramchain); int32_t iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle *bp,uint8_t *missings,int32_t priority,double mult); int32_t iguana_blocksmissing(struct iguana_info *coin,int32_t *nonzp,uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1],bits256 hashes[],double mult,struct iguana_bundle *bp,int32_t capacity); +FILE *myfopen(char *fname,char *mode); +int32_t myfclose(FILE *fp); extern int32_t HDRnet,netBLOCKS; diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index f80c1d0d3..c69f532ac 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1991,7 +1991,7 @@ int32_t iguana_realtime_update(struct iguana_info *coin) if ( bits256_cmp(coin->RThash1,bp->hashes[1]) != 0 ) coin->RThash1 = bp->hashes[1]; bp->lastRT = (uint32_t)time(NULL); - if ( coin->peers.numranked > 0 && time(NULL) > coin->RThdrstime+10 ) + if ( 0 && coin->peers.numranked > 0 && time(NULL) > coin->RThdrstime+10 ) { iguana_RThdrs(coin,bp,coin->peers.numranked); coin->RThdrstime = bp->lastRT; diff --git a/iguana/main.c b/iguana/main.c index 8639cd8e3..01558409a 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -23,7 +23,30 @@ #include "../pnacl_main.h" #include "iguana777.h" #include "SuperNET.h" -#include + +#undef fopen +#undef fclose +int32_t Fopen_count,Fclose_count; + +FILE *myfopen(char *fname,char *mode) +{ + FILE *fp; + if ( (fp= fopen(fname,mode)) != 0 ) + { + Fopen_count++; + if ( Fopen_count > 2*Fclose_count ) + printf("Fopens.%d vs Fcloses.%d [%d]\n",Fopen_count,Fclose_count,Fopen_count-Fclose_count); + return(fp); + } + return(0); +} + +int32_t myfclose(FILE *fp) +{ + Fclose_count++; + return(fclose(fp)); +} + // ALL globals must be here! char *Iguana_validcommands[] = { diff --git a/iguana/peggy.h b/iguana/peggy.h index c9b3e23a6..c53b219f7 100755 --- a/iguana/peggy.h +++ b/iguana/peggy.h @@ -371,5 +371,7 @@ uint32_t peggy_currentblock(void *globals); struct peggy_unit *peggy_match(struct accts777_info *accts,int32_t peg,uint64_t nxt64bits,bits256 lockhash,uint16_t lockdays); int32_t peggy_addunit(struct accts777_info *accts,struct peggy_unit *U,bits256 lockhash); +FILE *myfopen(char *fname,char *mode); +int32_t myfclose(FILE *fp); #endif