sock: only read from the fd if we find an event

Fixes a bug reported by George Bosilca.