Move connection-state handler further down the pipeline