style fixes to close_cb_stack
This commit is contained in:
parent
2414d7e728
commit
84ebdf8429
@ -1,6 +1,9 @@
|
|||||||
#include "../oio.h"
|
#include "../oio.h"
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
|
/* TODO: Add explanation of why we want on_close to be called from fresh
|
||||||
|
* stack.
|
||||||
|
*/
|
||||||
|
|
||||||
int nested = 0;
|
int nested = 0;
|
||||||
int close_cb_called = 0;
|
int close_cb_called = 0;
|
||||||
@ -18,19 +21,22 @@ TEST_IMPL(close_cb_stack) {
|
|||||||
|
|
||||||
oio_init();
|
oio_init();
|
||||||
|
|
||||||
if (oio_tcp_handle_init(&handle, &close_cb, NULL))
|
if (oio_tcp_handle_init(&handle, &close_cb, NULL)) {
|
||||||
FATAL(oio_tcp_handle_init failed)
|
FATAL(oio_tcp_handle_init failed)
|
||||||
|
}
|
||||||
|
|
||||||
nested++;
|
nested++;
|
||||||
|
|
||||||
if (oio_close(&handle))
|
if (oio_close(&handle)) {
|
||||||
FATAL(oio_close failed)
|
FATAL(oio_close failed)
|
||||||
|
}
|
||||||
|
|
||||||
nested--;
|
nested--;
|
||||||
|
|
||||||
oio_run();
|
oio_run();
|
||||||
|
|
||||||
ASSERT(close_cb_called && "oio_close_cb must be called exactly once")
|
ASSERT(nested == 0)
|
||||||
|
ASSERT(close_cb_called == 1 && "oio_close_cb must be called exactly once")
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user