Implement ping handling.