diff options
author | Mithun Iyer <iyerm@google.com> | 2020-11-09 14:52:50 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-09 14:54:57 -0800 |
commit | 199fcd0fe512f2fa4af63b0ec74e36aea7c4a8e1 (patch) | |
tree | df4a8866f0d479451039ce06adf78cbce9d04f06 /test/util | |
parent | 2fcca60a7bf084a28e878941d9dcb47e11268cbd (diff) |
Skip `EventHUp` notify in `FIN_WAIT2` on a socket close.
This Notify was added as part of cl/279106406; but notifying `EventHUp`
in `FIN_WAIT2` is incorrect, as we want to only notify later on
`TIME_WAIT` or a reset. However, we do need to notify any blocked
waiters of an activity on the endpoint with `EventIn`|`EventOut`.
PiperOrigin-RevId: 341490913
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/test_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/util/test_util.h b/test/util/test_util.h index 373c54f32..876ff58db 100644 --- a/test/util/test_util.h +++ b/test/util/test_util.h @@ -171,6 +171,7 @@ #include <stddef.h> #include <stdlib.h> #include <sys/uio.h> +#include <time.h> #include <unistd.h> #include <algorithm> @@ -271,6 +272,12 @@ PosixErrorOr<std::vector<OpenFd>> GetOpenFDs(); // Returns the number of hard links to a path. PosixErrorOr<uint64_t> Links(const std::string& path); +inline uint64_t ms_elapsed(const struct timespec& begin, + const struct timespec& end) { + return (end.tv_sec - begin.tv_sec) * 1000 + + (end.tv_nsec - begin.tv_nsec) / 1000000; +} + namespace internal { template <typename Container> |