function cancelFactory() {
            return function cancel() {
                cancel.requested = true;
                return agent;
            };
        }
@returns {Function} a cancel function for a task.