on WSAECONNRESET, just return 0, not error
set STATE_SHUTDOWN on shutdown, though nothing uses this right now;
maybe this should be removed, and instead say "always call Close()
at the end of successful processing in the thread" (to ensure that we don't
block later)