aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-08-01 17:29:10 -0400
committerNick Mathewson <nickm@torproject.org>2013-08-15 12:03:37 -0400
commit28bb673584b3e7e839bebce64bd986c6c4ad1faa (patch)
tree102e828fd7f9be5ab565686fa3e0062acec3d58f /src/or
parent636aeb1f24fadd4c6c45dbfd1539f6312c91cc60 (diff)
downloadtor-28bb673584b3e7e839bebce64bd986c6c4ad1faa.tar.gz
tor-28bb673584b3e7e839bebce64bd986c6c4ad1faa.zip
White-box tests for the succeeding case of ext_or_port handshake.
(Okay, white-box plus mocking enough other functions so they don't crash.)
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection_or.c4
-rw-r--r--src/or/connection_or.h3
-rw-r--r--src/or/main.c16
-rw-r--r--src/or/main.h8
4 files changed, 16 insertions, 15 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index a55ca3aa01..31fd6d6739 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1281,8 +1281,8 @@ connection_or_close_for_error(or_connection_t *orconn, int flush)
*
* Return -1 if <b>conn</b> is broken, else return 0.
*/
-int
-connection_tls_start_handshake(or_connection_t *conn, int receiving)
+MOCK_IMPL(int,
+connection_tls_start_handshake,(or_connection_t *conn, int receiving))
{
channel_listener_t *chan_listener;
channel_t *chan;
diff --git a/src/or/connection_or.h b/src/or/connection_or.h
index 85e68f1a33..8d93028932 100644
--- a/src/or/connection_or.h
+++ b/src/or/connection_or.h
@@ -45,7 +45,8 @@ void connection_or_close_for_error(or_connection_t *orconn, int flush);
void connection_or_report_broken_states(int severity, int domain);
-int connection_tls_start_handshake(or_connection_t *conn, int receiving);
+MOCK_DECL(int,connection_tls_start_handshake,(or_connection_t *conn,
+ int receiving));
int connection_tls_continue_handshake(or_connection_t *conn);
int connection_init_or_handshake_state(or_connection_t *conn,
diff --git a/src/or/main.c b/src/or/main.c
index 20cc292fd5..d8f86bcec4 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -519,8 +519,8 @@ connection_is_reading(connection_t *conn)
}
/** Tell the main loop to stop notifying <b>conn</b> of any read events. */
-void
-connection_stop_reading(connection_t *conn)
+MOCK_IMPL(void,
+connection_stop_reading,(connection_t *conn))
{
tor_assert(conn);
@@ -544,8 +544,8 @@ connection_stop_reading(connection_t *conn)
}
/** Tell the main loop to start notifying <b>conn</b> of any read events. */
-void
-connection_start_reading(connection_t *conn)
+MOCK_IMPL(void,
+connection_start_reading,(connection_t *conn))
{
tor_assert(conn);
@@ -584,8 +584,8 @@ connection_is_writing(connection_t *conn)
}
/** Tell the main loop to stop notifying <b>conn</b> of any write events. */
-void
-connection_stop_writing(connection_t *conn)
+MOCK_IMPL(void,
+connection_stop_writing,(connection_t *conn))
{
tor_assert(conn);
@@ -610,8 +610,8 @@ connection_stop_writing(connection_t *conn)
}
/** Tell the main loop to start notifying <b>conn</b> of any write events. */
-void
-connection_start_writing(connection_t *conn)
+MOCK_IMPL(void,
+connection_start_writing,(connection_t *conn))
{
tor_assert(conn);
diff --git a/src/or/main.h b/src/or/main.h
index 4aebe3eeee..df302ffa72 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -36,12 +36,12 @@ typedef enum watchable_events {
} watchable_events_t;
void connection_watch_events(connection_t *conn, watchable_events_t events);
int connection_is_reading(connection_t *conn);
-void connection_stop_reading(connection_t *conn);
-void connection_start_reading(connection_t *conn);
+MOCK_DECL(void,connection_stop_reading,(connection_t *conn));
+MOCK_DECL(void,connection_start_reading,(connection_t *conn));
int connection_is_writing(connection_t *conn);
-void connection_stop_writing(connection_t *conn);
-void connection_start_writing(connection_t *conn);
+MOCK_DECL(void,connection_stop_writing,(connection_t *conn));
+MOCK_DECL(void,connection_start_writing,(connection_t *conn));
void connection_stop_reading_from_linked_conn(connection_t *conn);