Cleanup client handshake code