Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com> (cherry picked from commit 9defd1de11539485f0b7d6e40b359e579603388b)
64 lines
2.3 KiB
Diff
64 lines
2.3 KiB
Diff
From 1044093af3d4e1db0ffa695bfaf5124f7589fa15 Mon Sep 17 00:00:00 2001
|
|
From: xuxuepeng <xuxuepeng1@huawei.com>
|
|
Date: Fri, 22 Nov 2024 02:51:29 +0800
|
|
Subject: [PATCH] change wait callback argument from u8 to c_char fix couples
|
|
of warnings as well
|
|
|
|
Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com>
|
|
---
|
|
sandbox/src/controller/client.rs | 1 -
|
|
sandbox/src/lib.rs | 11 +++++------
|
|
2 files changed, 5 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/sandbox/src/controller/client.rs b/sandbox/src/controller/client.rs
|
|
index c02954b..25377fd 100644
|
|
--- a/sandbox/src/controller/client.rs
|
|
+++ b/sandbox/src/controller/client.rs
|
|
@@ -32,7 +32,6 @@ use sandbox::containerd::services::sandbox::v1::ControllerUpdateRequest;
|
|
use sandbox::containerd::services::sandbox::v1::ControllerUpdateResponse;
|
|
|
|
use tonic::transport::Channel;
|
|
-use tower::ServiceExt;
|
|
#[derive(Debug, Clone)]
|
|
pub struct Client {
|
|
pub channel: Channel,
|
|
diff --git a/sandbox/src/lib.rs b/sandbox/src/lib.rs
|
|
index ac24c7d..1d2626c 100644
|
|
--- a/sandbox/src/lib.rs
|
|
+++ b/sandbox/src/lib.rs
|
|
@@ -16,8 +16,7 @@ mod datatype;
|
|
use controller::client;
|
|
use datatype::sandbox_types;
|
|
use tokio::time::{ sleep, Duration };
|
|
-use std::os::raw::{c_char, c_int, c_void};
|
|
-use std::sync::{ Arc, Mutex };
|
|
+use std::os::raw::{c_char, c_int};
|
|
use lazy_static::lazy_static;
|
|
use tokio::runtime::Runtime;
|
|
use async_recursion::async_recursion;
|
|
@@ -228,9 +227,9 @@ pub unsafe extern "C" fn sandbox_api_update(
|
|
sandbox_api_execute!(controller_context, r_req, update)
|
|
}
|
|
|
|
-pub type SandboxReadyCallback = extern "C" fn(*const u8);
|
|
-pub type SandboxPendingCallback = extern "C" fn(*const u8);
|
|
-pub type SandboxExitCallback = extern "C" fn(*const u8, *const sandbox_types::SandboxWaitResponse);
|
|
+pub type SandboxReadyCallback = extern "C" fn(*const c_char);
|
|
+pub type SandboxPendingCallback = extern "C" fn(*const c_char);
|
|
+pub type SandboxExitCallback = extern "C" fn(*const c_char, *const sandbox_types::SandboxWaitResponse);
|
|
|
|
#[repr(C)]
|
|
pub struct SandboxWaitCallback {
|
|
@@ -269,7 +268,7 @@ pub async fn is_connection_alive(
|
|
match (*client).platform(r_req).await {
|
|
Ok(_) => true,
|
|
Err(e) => {
|
|
- println!("Sandbox API: Failed to connect to client, {:?}", sandbox_id);
|
|
+ println!("Sandbox API: Failed to connect to client, {:?}, {:?}", sandbox_id, e);
|
|
false
|
|
}
|
|
}
|
|
--
|
|
2.33.0
|
|
|