/* Like connection_ap_make_link(), but does much less */ static connection_t * test_conn_get_linked_connection(connection_t *l_conn, uint8_t state) { tt_assert(l_conn); assert_connection_ok(l_conn, time(NULL)); /* AP connections don't seem to have purposes */ connection_t *conn = test_conn_get_connection(state, CONN_TYPE_AP, 0); tt_assert(conn); assert_connection_ok(conn, time(NULL)); conn->linked = 1; l_conn->linked = 1; conn->linked_conn = l_conn; l_conn->linked_conn = conn; /* we never opened a real socket, so we can just overwrite it */ conn->s = TOR_INVALID_SOCKET; l_conn->s = TOR_INVALID_SOCKET; assert_connection_ok(conn, time(NULL)); assert_connection_ok(l_conn, time(NULL)); return conn; done: test_conn_download_status_teardown(NULL, NULL); return NULL; }
static dir_connection_t * test_conn_download_status_add_a_connection(void) { dir_connection_t *conn = DOWNCAST(dir_connection_t, test_conn_get_rsrc_setup(NULL)); tt_assert(conn); assert_connection_ok(&conn->base_, time(NULL)); return conn; done: test_conn_download_status_teardown(NULL, NULL); return NULL; }