diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-21 14:34:20 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-21 16:54:26 -0800 |
| commit | df8a6718208e6d9be662804f633d4644e2ce83e9 (patch) | |
| tree | 0a762adb89f15e05dd661c099fe55350d6f56950 | |
| parent | bcd57a6d7ac799e7f04000a84b6868948fb137c6 (diff) | |
| download | nng-df8a6718208e6d9be662804f633d4644e2ce83e9.tar.gz nng-df8a6718208e6d9be662804f633d4644e2ce83e9.tar.bz2 nng-df8a6718208e6d9be662804f633d4644e2ce83e9.zip | |
nuts: add 20 millisecond delay before nng_fini
This is to allow finalizers to run for the HTTP framework. This is
a bug workaround for now, and should be fixed in the HTTP framework
later by using reference counts correctly.
| -rw-r--r-- | src/testing/nuts.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/testing/nuts.h b/src/testing/nuts.h index f2e50c2c..421e0a53 100644 --- a/src/testing/nuts.h +++ b/src/testing/nuts.h @@ -23,8 +23,15 @@ extern void nuts_logger( nng_log_level, nng_log_facility, const char *, const char *); // Call nng_fini during test finalization -- this avoids leak warnings. +// We add a 20 millisecond delay as a hack to allow for other subsytems to +// drain first. (Notably the HTTP framework can fail if we shut down too +// quickly. These bugs should be fixed and then the sleep can be removed.) #ifndef TEST_FINI -#define TEST_FINI nng_fini() +#define TEST_FINI \ + do { \ + nng_msleep(20); \ + nng_fini(); \ + } while (0) #endif #ifndef TEST_INIT |
