From 60cb3eb8b296e2aebbda6ccc161e99ad2bc7ca4a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 6 Jan 2010 14:27:46 -0800 Subject: vconn: Convert vconn code to modern OVS structure. The vconn code is a relative fossil as OVS code goes. It was written before we had really figured how code should fit together. Part of that history is that it used poll_fd_callback() to register callbacks without the assistance of other code. That isn't how the rest of OVS works now; this code is the only remaining user of that function. To make it more like the rest of the system, this code gets rid of the use of poll_fd_callback(). It also adds vconn_run() and vconn_run_wait() functions and calls to them from the places where they are now required. --- tests/test-vconn.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/test-vconn.c') diff --git a/tests/test-vconn.c b/tests/test-vconn.c index 34c2930a4..87e35c4ae 100644 --- a/tests/test-vconn.c +++ b/tests/test-vconn.c @@ -143,6 +143,7 @@ test_refuse_connection(const char *type, int expected_error) fpv_create(type, &fpv); assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn)); fpv_close(&fpv); + vconn_run(vconn); assert(vconn_connect(vconn) == expected_error); vconn_close(vconn); fpv_destroy(&fpv); @@ -159,6 +160,7 @@ test_accept_then_close(const char *type, int expected_error) fpv_create(type, &fpv); assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn)); + vconn_run(vconn); close(fpv_accept(&fpv)); fpv_close(&fpv); assert(vconn_connect(vconn) == expected_error); @@ -178,6 +180,7 @@ test_read_hello(const char *type, int expected_error) fpv_create(type, &fpv); assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn)); + vconn_run(vconn); fd = fpv_accept(&fpv); fpv_destroy(&fpv); assert(!set_nonblocking(fd)); @@ -195,7 +198,9 @@ test_read_hello(const char *type, int expected_error) assert(errno == EAGAIN); } + vconn_run(vconn); assert(vconn_connect(vconn) == EAGAIN); + vconn_run_wait(vconn); vconn_connect_wait(vconn); poll_fd_wait(fd, POLLIN); poll_block(); @@ -221,6 +226,7 @@ test_send_hello(const char *type, const void *out, size_t out_size, fpv_create(type, &fpv); assert(!vconn_open(fpv.vconn_name, OFP_VERSION, &vconn)); + vconn_run(vconn); fd = fpv_accept(&fpv); fpv_destroy(&fpv); @@ -243,6 +249,7 @@ test_send_hello(const char *type, const void *out, size_t out_size, } } + vconn_run(vconn); if (!connected) { int error = vconn_connect(vconn); if (error == expect_connect_error) { @@ -262,6 +269,7 @@ test_send_hello(const char *type, const void *out, size_t out_size, break; } + vconn_run_wait(vconn); if (!connected) { vconn_connect_wait(vconn); } -- cgit v1.2.1