You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@teaclave.apache.org by GitBox <gi...@apache.org> on 2022/01/24 19:37:07 UTC

[GitHub] [incubator-teaclave] ya0guang commented on a change in pull request #601: update Rust and c API for cancel_task

ya0guang commented on a change in pull request #601:
URL: https://github.com/apache/incubator-teaclave/pull/601#discussion_r791090534



##########
File path: services/management/enclave/src/service.rs
##########
@@ -662,17 +662,24 @@ impl TeaclaveManagement for TeaclaveManagementService {
                 self.enqueue_to_db(CANCEL_QUEUE_KEY.as_bytes(), &ts)?;
             }
             _ => {
+                // early cancelation
                 // race will not affect correctness/privacy
-                let task: Task<Cancel> = ts.try_into().map_err(|e| {
+                let mut task: Task<Cancel> = ts.try_into().map_err(|e| {
                     log::warn!("Cancel state error: {:?}", e);
                     TeaclaveManagementServiceError::PermissionDenied
                 })?;
 
                 log::debug!("Canceled Task: {:?}", task);
 
+                task.update_result(TaskResult::Err(TaskFailure {
+                    reason: "Task canceled".to_string(),
+                }))
+                .map_err(|_| TeaclaveManagementServiceError::PermissionDenied)?;
                 let ts: TaskState = task.into();
                 self.write_to_db(&ts)
                     .map_err(|_| TeaclaveManagementServiceError::StorageError)?;
+
+                log::warn!("Canceled Task writtenback");

Review comment:
       Thanks! Just adde`:`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org