api: handle conn keepalive case in get/set opt