summaryrefslogtreecommitdiff
path: root/src/common/compat.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-01-18 15:33:04 -0500
committerNick Mathewson <nickm@torproject.org>2012-01-18 15:33:04 -0500
commitd1b40cf2e7bb55d3c421e6eff476330e08ab4750 (patch)
tree557d4747579301e39f77e4889e84739793690ca3 /src/common/compat.h
parent1772782e425734967981b79be1122017ef606dd0 (diff)
parentdea0720dadea8f3915901833115726f4ba0d48f4 (diff)
downloadtor-d1b40cf2e7bb55d3c421e6eff476330e08ab4750.tar.gz
tor-d1b40cf2e7bb55d3c421e6eff476330e08ab4750.zip
Merge remote-tracking branch 'public/bug4533_part1'
Conflicts: src/common/compat.h
Diffstat (limited to 'src/common/compat.h')
-rw-r--r--src/common/compat.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 5bf12cdf89..4329d45369 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -399,11 +399,19 @@ typedef int socklen_t;
#endif
#ifdef MS_WINDOWS
+/* XXX Actually, this should arguably be SOCKET; we use intptr_t here so that
+ * any inadvertant checks for the socket being <= 0 or > 0 will probably
+ * still work. */
#define tor_socket_t intptr_t
#define SOCKET_OK(s) ((SOCKET)(s) != INVALID_SOCKET)
+#define TOR_INVALID_SOCKET INVALID_SOCKET
#else
+/** Type used for a network socket. */
#define tor_socket_t int
+/** Macro: true iff 's' is a possible value for a valid initialized socket. */
#define SOCKET_OK(s) ((s) >= 0)
+/** Error/uninitialized value for a tor_socket_t. */
+#define TOR_INVALID_SOCKET (-1)
#endif
int tor_close_socket(tor_socket_t s);