Restructure nested if in ctlconn_write_handler().