fix the bug that did not properly handle errors on getnameinfo().
fix the bug that caused to fail in getnameinfo() on *BSD*.
add a sanity check.
disable unnecessary hack on NetBSD, which is required on Linux.
change a state when EV_WRITE is raised as well.