Finalize control server regression fixture cleanup
This commit is contained in:
1 parent
fdf2912427
commit
e620567804
1 file changed
+4
@@ -53,6 +53,7 @@ ssize_t __wrap_send(socket_t fd, const void* data, size_t len, int flags) {
|
||||
struct fixture {
|
||||
struct UTUN_INSTANCE inst;
|
||||
struct control_server server;
|
||||
struct CFG_CONTROL_ALLOW allow;
|
||||
socket_t peer;
|
||||
size_t allocations;
|
||||
};
|
||||
@@ -62,6 +63,7 @@ static void fixture_init(struct fixture* f) {
|
||||
f->allocations = u_get_allocated_count();
|
||||
f->inst.ua = uasync_create(); assert(f->inst.ua);
|
||||
f->inst.config = u_calloc(1, sizeof(*f->inst.config)); assert(f->inst.config);
|
||||
f->inst.config->global.control_allows = &f->allow;
|
||||
f->inst.config->global.control_allow_count = 1;
|
||||
f->inst.config->global.control_allows[0].network = INADDR_LOOPBACK;
|
||||
f->inst.config->global.control_allows[0].netmask = UINT32_MAX;
|
||||
@@ -80,6 +82,8 @@ static void fixture_destroy(struct fixture* f) {
|
||||
capture_fd = -1; send_mode = 0;
|
||||
control_server_shutdown(&f->server);
|
||||
if (f->peer >= 0) close(f->peer);
|
||||
TimeoutEntry pending;
|
||||
assert(timeout_heap_peek(f->inst.ua->timeout_heap, &pending) != 0);
|
||||
assert(timeout_heap_get_size(f->inst.ua->timeout_heap) == 0);
|
||||
assert(f->inst.ua->timer_alloc_count == f->inst.ua->timer_free_count);
|
||||
uasync_destroy(f->inst.ua, 0); u_free(f->inst.config);
|
||||
|
||||
Reference in new issue
Block a user