lib/tsocket: fix non-blockging connect() error handling