diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-11-18 19:19:41 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2009-11-18 19:19:41 +0000 |
commit | c5c7911dab8732861affbe66849a100da62f7464 (patch) | |
tree | bfbb16bc8fbcb4911a24a5e32f9f4c3c280f392c /util.h | |
parent | b349e3dca89dfff5fe70669f9fd3f3a1ec60a498 (diff) |
bugfix Db::open/close and zombie sockets bugs fix double-close of socket handle,
keep databases open,
close db cursors,
initial block download in batches of 500 blocks,
fix misc warnings,
subver linux-test8
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@40 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -57,9 +57,11 @@ inline T& REF(const T& val) #ifdef __WXMSW__
#define MSG_NOSIGNAL 0
#define MSG_DONTWAIT 0
+#ifndef UINT64_MAX
#define UINT64_MAX _UI64_MAX
#define INT64_MAX _I64_MAX
#define INT64_MIN _I64_MIN
+#endif
#else
#define WSAGetLastError() errno
#define WSAEWOULDBLOCK EWOULDBLOCK
@@ -67,7 +69,7 @@ inline T& REF(const T& val) #define WSAEINTR EINTR
#define WSAEINPROGRESS EINPROGRESS
#define WSAEADDRINUSE EADDRINUSE
-#define closesocket(s) close(s)
+#define WSAENOTSOCK EBADF
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR -1
typedef u_int SOCKET;
@@ -80,6 +82,23 @@ typedef u_int SOCKET; #define Beep(n1,n2) (0)
#endif
+inline int myclosesocket(SOCKET& hSocket)
+{
+ if (hSocket == INVALID_SOCKET)
+ return WSAENOTSOCK;
+#ifdef __WXMSW__
+ int ret = closesocket(hSocket);
+#else
+ int ret = close(hSocket);
+#endif
+ hSocket = INVALID_SOCKET;
+ return ret;
+}
+#define closesocket(s) myclosesocket(s)
+
+
+
+
@@ -149,7 +168,7 @@ public: bool TryEnter() { return mutex.TryLock() == wxMUTEX_NO_ERROR; }
#endif
public:
- char* pszFile;
+ const char* pszFile;
int nLine;
};
|