If an I/O watcher callback fails to read(), returning zero, we check
events for UEV_HUP to detect EOF or socket remote end shutdown().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds UEV_ERROR handling to the test I/O watcher, restarting
the watcher properly. Also, additional error handling to read(), which
was unchecked and failed when fuzzing the libc read() function.
We also take the opportunity to document the reasons for when using the
w->fd (watcher descriptor) and when *not* to in the test. Even to the
author this was confusing and looked suspicious.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Many users look at both examples *and* unit tests to learn how to use a
library. We should pride ourselves in that we have not just working but
also correct and readable tests.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>