aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-09-27 07:33:07 +0000
committerRoger Dingledine <arma@torproject.org>2003-09-27 07:33:07 +0000
commit0f25887048ee589a7e3f83e7faaf72f7d86f97e2 (patch)
tree4815c82a4e5f6922e7c11aedbbd47578a89f3da1 /src
parentdeac70439953008450fd1c17cad12c2a78a7c04b (diff)
downloadtor-0f25887048ee589a7e3f83e7faaf72f7d86f97e2.tar
tor-0f25887048ee589a7e3f83e7faaf72f7d86f97e2.tar.gz
clean up connection_assert_ok compiler warnings
svn:r498
Diffstat (limited to 'src')
-rw-r--r--src/or/buffers.c2
-rw-r--r--src/or/or.h65
2 files changed, 34 insertions, 33 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index eba73a233..e23270e85 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -44,7 +44,7 @@ int find_on_inbuf(char *string, int string_len, buf_t *buf) {
/* Create and return a new buf of size 'size'
*/
-static buf_t *buf_new_with_capacity(size_t size) {
+buf_t *buf_new_with_capacity(size_t size) {
buf_t *buf;
buf = (buf_t*)tor_malloc(sizeof(buf_t));
buf->buf = (char *)tor_malloc(size);
diff --git a/src/or/or.h b/src/or/or.h
index 965c6ebac..948518a5d 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -124,46 +124,47 @@
#define DNSWORKER_STATE_IDLE 0
#define DNSWORKER_STATE_BUSY 1
-#define _CPUWORKER_STATE_MIN 0
-#define CPUWORKER_STATE_IDLE 0
-#define CPUWORKER_STATE_BUSY_ONION 1
-#define CPUWORKER_STATE_BUSY_HANDSHAKE 2
-#define _CPUWORKER_STATE_MAX 2
+#define _CPUWORKER_STATE_MIN 1
+#define CPUWORKER_STATE_IDLE 1
+#define CPUWORKER_STATE_BUSY_ONION 2
+#define CPUWORKER_STATE_BUSY_HANDSHAKE 3
+#define _CPUWORKER_STATE_MAX 3
#define CPUWORKER_TASK_ONION CPUWORKER_STATE_BUSY_ONION
-#define _OR_CONN_STATE_MIN 0
-#define OR_CONN_STATE_CONNECTING 0 /* waiting for connect() to finish */
-#define OR_CONN_STATE_HANDSHAKING 1 /* SSL is handshaking, not done yet */
-#define OR_CONN_STATE_OPEN 2 /* ready to send/receive cells. */
-#define _OR_CONN_STATE_MAX 2
-
-#define _EXIT_CONN_STATE_MIN 0
-#define EXIT_CONN_STATE_RESOLVING 0 /* waiting for response from dns farm */
-#define EXIT_CONN_STATE_CONNECTING 1 /* waiting for connect() to finish */
-#define EXIT_CONN_STATE_OPEN 2
-#define _EXIT_CONN_STATE_MAX 2
+#define _OR_CONN_STATE_MIN 1
+#define OR_CONN_STATE_CONNECTING 1 /* waiting for connect() to finish */
+#define OR_CONN_STATE_HANDSHAKING 2 /* SSL is handshaking, not done yet */
+#define OR_CONN_STATE_OPEN 3 /* ready to send/receive cells. */
+#define _OR_CONN_STATE_MAX 3
+
+#define _EXIT_CONN_STATE_MIN 1
+#define EXIT_CONN_STATE_RESOLVING 1 /* waiting for response from dns farm */
+#define EXIT_CONN_STATE_CONNECTING 2 /* waiting for connect() to finish */
+#define EXIT_CONN_STATE_OPEN 3
+#define _EXIT_CONN_STATE_MAX 3
#if 0
#define EXIT_CONN_STATE_CLOSE 3 /* flushing the buffer, then will close */
#define EXIT_CONN_STATE_CLOSE_WAIT 4 /* have sent a destroy, awaiting a confirmation */
#endif
-#define _AP_CONN_STATE_MIN 3
-#define AP_CONN_STATE_SOCKS_WAIT 3
-#define AP_CONN_STATE_OR_WAIT 4
-#define AP_CONN_STATE_OPEN 5
-#define _AP_CONN_STATE_MAX 5
-
-#define _DIR_CONN_STATE_MIN 0
-#define DIR_CONN_STATE_CONNECTING_FETCH 0
-#define DIR_CONN_STATE_CONNECTING_UPLOAD 1
-#define DIR_CONN_STATE_CLIENT_SENDING_FETCH 2
-#define DIR_CONN_STATE_CLIENT_SENDING_UPLOAD 3
-#define DIR_CONN_STATE_CLIENT_READING_FETCH 4
-#define DIR_CONN_STATE_CLIENT_READING_UPLOAD 5
-#define DIR_CONN_STATE_SERVER_COMMAND_WAIT 6
-#define DIR_CONN_STATE_SERVER_WRITING 7
-#define _DIR_CONN_STATE_MAX 7
+/* the AP state values must be disjoint from the EXIT state values */
+#define _AP_CONN_STATE_MIN 4
+#define AP_CONN_STATE_SOCKS_WAIT 4
+#define AP_CONN_STATE_OR_WAIT 5
+#define AP_CONN_STATE_OPEN 6
+#define _AP_CONN_STATE_MAX 6
+
+#define _DIR_CONN_STATE_MIN 1
+#define DIR_CONN_STATE_CONNECTING_FETCH 1
+#define DIR_CONN_STATE_CONNECTING_UPLOAD 2
+#define DIR_CONN_STATE_CLIENT_SENDING_FETCH 3
+#define DIR_CONN_STATE_CLIENT_SENDING_UPLOAD 4
+#define DIR_CONN_STATE_CLIENT_READING_FETCH 5
+#define DIR_CONN_STATE_CLIENT_READING_UPLOAD 6
+#define DIR_CONN_STATE_SERVER_COMMAND_WAIT 7
+#define DIR_CONN_STATE_SERVER_WRITING 8
+#define _DIR_CONN_STATE_MAX 8
#define CIRCUIT_STATE_BUILDING 0 /* I'm the OP, still haven't done all my handshakes */
#define CIRCUIT_STATE_ONIONSKIN_PENDING 1 /* waiting to process the onionskin */