Fix connection detection logic.

The fact that we have socket back from IO::select, does not necessarily
mean that mean that we can actually ready and/or write to it.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
yeah, as of 59235ae3d772f136e90017c333368887c25e2de8 (1.5 months ago) we've "switched over."