EnterCriticalSection copy&paste bug
index 90858c8..61b2702 100644
--- a/xptMiner/global.h
+++ b/xptMiner/global.h
@@ -25,7 +25,7 @@
#define strcpy_s(dest,val,src) strncopy(dest,src,val)
#define __debugbreak(); raise(SIGTRAP);
#define CRITICAL_SECTION pthread_mutex_t
-#define EnterCriticalSection(Section) pthread_mutex_unlock(Section)
+#define EnterCriticalSection(Section) pthread_mutex_lock(Section)
#define LeaveCriticalSection(Section) pthread_mutex_unlock(Section)
#define InitializeCriticalSection(Section) pthread_mutex_init(Section, NULL)
#define DestroyCriticalSection(Section) pthread_mutex_destroy(Section)
(I had also added DestroyCriticalSection)
also, it would be a good idea to check the return values of pthread_*.
xptClient_free could have DestroyCriticalSection for cs_workAccess and cs_shareSubmit.
why cs_workAccess is not being used, no EnterCriticalSection / LeaveCriticalSection?
another mem leak, saves a couple of GiB a day:
index 258377f..a17586c 100644
--- a/xptMiner/main.cpp
+++ b/xptMiner/main.cpp
@@ -663,7 +663,9 @@ void xptMiner_xptQueryWorkLoop()
{
// initiate new connection
EnterCriticalSection(&cs_xptClient);
+ xptClient_free(xptClient);
xptClient = xptMiner_initateNewXptConnectionObject();
+
if(minerSettings.requestTarget.donationPercent > 0.1f)
{
//xptClient_addDeveloperFeeEntry(xptClient, "MK6n2VZZBpQrqpP9rtzsC9PRi5t1qsWuGc", getFeeFromDouble(minerSettings.requestTarget.donationPercent / 2.0));
also SIGPIPE should be ignored, I have it done in my version with sigaction
http://stackoverflow.com/questions/108183/how-to-prevent-sigpipes-or-handle-them-properly
makefile could be fixed to handle dependencies, gcc -MM *.cpp *.c