fixed infinite hang. eof can be received before waiting lock