From 41b2ff63012a592339e2f5cd8ffa7140892fbe21 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sat, 27 Sep 2003 07:33:07 +0000 Subject: [PATCH] clean up connection_assert_ok compiler warnings svn:r498 --- trunk/src/or/buffers.c | 2 +- trunk/src/or/or.h | 61 +++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/trunk/src/or/buffers.c b/trunk/src/or/buffers.c index eba73a233d..e23270e85e 100644 --- a/trunk/src/or/buffers.c +++ b/trunk/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/trunk/src/or/or.h b/trunk/src/or/or.h index 965c6ebacb..948518a5dd 100644 --- a/trunk/src/or/or.h +++ b/trunk/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 _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 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 _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 +/* 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 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 +#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 */