X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fstream%2Ftest_stream_2peers_halfclose.c;h=95f5aa9fafb942238d838b242dca14d3572bd94c;hb=6973ade884b8e22e7fcaa51a90d00a8caa2d2fa4;hp=2502615c2e65b0a035552bb6d5c1976a15f6a2d1;hpb=0c1c5a9be5e6cd117736a569e60ae79c739c56ef;p=oweals%2Fgnunet.git diff --git a/src/stream/test_stream_2peers_halfclose.c b/src/stream/test_stream_2peers_halfclose.c index 2502615c2..95f5aa9fa 100644 --- a/src/stream/test_stream_2peers_halfclose.c +++ b/src/stream/test_stream_2peers_halfclose.c @@ -23,17 +23,12 @@ * @brief Testcases for Stream API halfclosed connections between 2 peers * @author Sree Harsha Totakura */ - -#include - #include "platform.h" #include "gnunet_util_lib.h" #include "gnunet_testbed_service.h" #include "gnunet_mesh_service.h" #include "gnunet_stream_lib.h" -#define VERBOSE 1 - /** * Number of peers */ @@ -60,12 +55,12 @@ struct PeerData /** * Peer's io write handle */ - struct GNUNET_STREAM_IOWriteHandle *io_write_handle; + struct GNUNET_STREAM_WriteHandle *io_write_handle; /** * Peer's io read handle */ - struct GNUNET_STREAM_IOReadHandle *io_read_handle; + struct GNUNET_STREAM_ReadHandle *io_read_handle; /** * Peer's shutdown handle @@ -147,11 +142,6 @@ enum Test */ enum SetupState { - /** - * The initial state - */ - INIT, - /** * Get the identity of peer 1 */ @@ -264,6 +254,7 @@ stream_read_task (void *cls, case PEER1_WRITE_SHUTDOWN: GNUNET_assert (&peer2 == peer); GNUNET_assert (NULL == peer->io_read_handle); + peer2.test_ok = GNUNET_YES; transition (); /* to PEER1_HALFCLOSE_READ */ break; default: @@ -619,8 +610,8 @@ input_processor (void *cls, } break; case PEER1_WRITE_SHUTDOWN: - GNUNET_assert (GNUNET_STREAM_SHUTDOWN == status); - peer2.test_ok = GNUNET_YES; + GNUNET_assert (0); /* This callback will not be called when stream + is shutdown */ break; case PEER1_HALFCLOSE_WRITE_FAIL: case PEER1_READ_SHUTDOWN: @@ -828,14 +819,6 @@ controller_event_cb (void *cls, { switch (event->type) { - case GNUNET_TESTBED_ET_CONNECT: - GNUNET_assert (INIT == setup_state); - GNUNET_TESTBED_operation_done (op); - op = GNUNET_TESTBED_peer_get_information (peer1.peer, - GNUNET_TESTBED_PIT_IDENTITY, - &peerinfo_cb, NULL); - setup_state = PEER1_GET_IDENTITY; - break; case GNUNET_TESTBED_ET_OPERATION_FINISHED: switch (setup_state) { @@ -869,11 +852,13 @@ test_master (void *cls, unsigned int num_peers, GNUNET_assert (NULL != peers[1]); peer1.peer = peers[0]; peer2.peer = peers[1]; - op = GNUNET_TESTBED_overlay_connect (NULL, NULL, NULL, peer2.peer, peer1.peer); - setup_state = INIT; + op = GNUNET_TESTBED_peer_get_information (peer1.peer, + GNUNET_TESTBED_PIT_IDENTITY, + &peerinfo_cb, NULL); + setup_state = PEER1_GET_IDENTITY; abort_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply - (GNUNET_TIME_UNIT_SECONDS, 40), &do_abort, + (GNUNET_TIME_UNIT_SECONDS, 1000), &do_abort, NULL); } @@ -887,11 +872,12 @@ int main (int argc, char **argv) result = GNUNET_NO; event_mask = 0; - event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); - GNUNET_TESTBED_test_run ("test_stream_2peers_halfclose", - "test_stream_local.conf", NUM_PEERS, event_mask, - &controller_event_cb, NULL, &test_master, NULL); + (void) GNUNET_TESTBED_test_run ("test_stream_2peers_halfclose", + "test_stream_local.conf", NUM_PEERS, + event_mask, + &controller_event_cb, NULL, &test_master, + NULL); if (GNUNET_SYSERR == result) return 1; return 0;