diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/allocators.h | 1 | ||||
-rw-r--r-- | src/netbase.cpp | 4 | ||||
-rw-r--r-- | src/sync.cpp | 8 | ||||
-rw-r--r-- | src/sync.h | 7 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/allocators.h b/src/allocators.h index 4b3356e874..ddeabc48c5 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -117,7 +117,6 @@ struct zero_after_free_allocator : public std::allocator<T> }; // This is exactly like std::string, but with a custom allocator. -// (secure_allocator<> is defined in serialize.h) typedef std::basic_string<char, std::char_traits<char>, secure_allocator<char> > SecureString; #endif diff --git a/src/netbase.cpp b/src/netbase.cpp index 80b0e32c39..d1ead79ebb 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -1010,7 +1010,7 @@ bool operator<(const CService& a, const CService& b) bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const { if (IsIPv4()) { - if (*addrlen < sizeof(struct sockaddr_in)) + if (*addrlen < (socklen_t)sizeof(struct sockaddr_in)) return false; *addrlen = sizeof(struct sockaddr_in); struct sockaddr_in *paddrin = (struct sockaddr_in*)paddr; @@ -1023,7 +1023,7 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const } #ifdef USE_IPV6 if (IsIPv6()) { - if (*addrlen < sizeof(struct sockaddr_in6)) + if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6)) return false; *addrlen = sizeof(struct sockaddr_in6); struct sockaddr_in6 *paddrin6 = (struct sockaddr_in6*)paddr; diff --git a/src/sync.cpp b/src/sync.cpp index f2403a43f2..dbd9ebdaee 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -7,6 +7,14 @@ #include <boost/foreach.hpp> +#ifdef DEBUG_LOCKCONTENTION +void PrintLockContention(const char* pszName, const char* pszFile, int nLine) +{ + printf("LOCKCONTENTION: %s\n", pszName); + printf("Locker: %s:%d\n", pszFile, nLine); +} +#endif /* DEBUG_LOCKCONTENTION */ + #ifdef DEBUG_LOCKORDER // // Early deadlock detection. diff --git a/src/sync.h b/src/sync.h index dffe4f6ee8..98640e6eab 100644 --- a/src/sync.h +++ b/src/sync.h @@ -27,6 +27,10 @@ void static inline EnterCritical(const char* pszName, const char* pszFile, int n void static inline LeaveCritical() {} #endif +#ifdef DEBUG_LOCKCONTENTION +void PrintLockContention(const char* pszName, const char* pszFile, int nLine); +#endif + /** Wrapper around boost::interprocess::scoped_lock */ template<typename Mutex> class CMutexLock @@ -43,8 +47,7 @@ public: #ifdef DEBUG_LOCKCONTENTION if (!lock.try_lock()) { - printf("LOCKCONTENTION: %s\n", pszName); - printf("Locker: %s:%d\n", pszFile, nLine); + PrintLockContention(pszName, pszFile, nLine); #endif lock.lock(); #ifdef DEBUG_LOCKCONTENTION |