mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-06 06:03:28 +00:00
dragonball: use crossbeam_channel in VmmService instead of mpsc::channel
Because crossbeam_channel has more features and better performance than mpsc::channel and finally rust replace its channel implementation with crossbeam_channel on version 1.67 Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
299fc35c37
commit
0301194851
1
src/dragonball/Cargo.lock
generated
1
src/dragonball/Cargo.lock
generated
@ -413,6 +413,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"bytes",
|
||||
"crossbeam-channel",
|
||||
"dbs-address-space",
|
||||
"dbs-allocator",
|
||||
"dbs-arch",
|
||||
|
@ -39,6 +39,7 @@ thiserror = "1"
|
||||
vmm-sys-util = "0.11.0"
|
||||
virtio-queue = { version = "0.4.0", optional = true }
|
||||
vm-memory = { version = "0.9.0", features = ["backend-mmap"] }
|
||||
crossbeam-channel = "0.5.6"
|
||||
|
||||
[dev-dependencies]
|
||||
slog-term = "2.9.0"
|
||||
@ -47,7 +48,7 @@ test-utils = { path = "../libs/test-utils" }
|
||||
|
||||
[features]
|
||||
acpi = []
|
||||
atomic-guest-memory = [ "vm-memory/backend-atomic" ]
|
||||
atomic-guest-memory = ["vm-memory/backend-atomic"]
|
||||
hotplug = ["virtio-vsock"]
|
||||
virtio-vsock = ["dbs-virtio-devices/virtio-vsock", "virtio-queue"]
|
||||
virtio-blk = ["dbs-virtio-devices/virtio-blk", "virtio-queue"]
|
||||
|
@ -7,8 +7,8 @@
|
||||
// found in the THIRD-PARTY file.
|
||||
|
||||
use std::fs::File;
|
||||
use std::sync::mpsc::{Receiver, Sender, TryRecvError};
|
||||
|
||||
use crossbeam_channel::{Receiver, Sender, TryRecvError};
|
||||
use log::{debug, error, info, warn};
|
||||
|
||||
use crate::error::{Result, StartMicroVmError, StopMicrovmError};
|
||||
@ -676,9 +676,9 @@ fn handle_cpu_topology(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::sync::mpsc::channel;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use crossbeam_channel::unbounded;
|
||||
use dbs_utils::epoll_manager::EpollManager;
|
||||
use test_utils::skip_if_not_root;
|
||||
use vmm_sys_util::tempfile::TempFile;
|
||||
@ -702,8 +702,8 @@ mod tests {
|
||||
}
|
||||
|
||||
fn check_request(&mut self) {
|
||||
let (to_vmm, from_api) = channel();
|
||||
let (to_api, from_vmm) = channel();
|
||||
let (to_vmm, from_api) = unbounded();
|
||||
let (to_api, from_vmm) = unbounded();
|
||||
|
||||
let epoll_mgr = EpollManager::default();
|
||||
let vmm = Arc::new(Mutex::new(create_vmm_instance(epoll_mgr.clone())));
|
||||
@ -728,8 +728,8 @@ mod tests {
|
||||
fn test_vmm_action_receive_unknown() {
|
||||
skip_if_not_root!();
|
||||
|
||||
let (_to_vmm, from_api) = channel();
|
||||
let (to_api, _from_vmm) = channel();
|
||||
let (_to_vmm, from_api) = unbounded();
|
||||
let (to_api, _from_vmm) = unbounded();
|
||||
let epoll_mgr = EpollManager::default();
|
||||
let vmm = Arc::new(Mutex::new(create_vmm_instance(epoll_mgr.clone())));
|
||||
let mut vservice = VmmService::new(from_api, to_api);
|
||||
@ -742,8 +742,8 @@ mod tests {
|
||||
#[should_panic]
|
||||
#[test]
|
||||
fn test_vmm_action_disconnected() {
|
||||
let (to_vmm, from_api) = channel();
|
||||
let (to_api, _from_vmm) = channel();
|
||||
let (to_vmm, from_api) = unbounded();
|
||||
let (to_api, _from_vmm) = unbounded();
|
||||
let epoll_mgr = EpollManager::default();
|
||||
let vmm = Arc::new(Mutex::new(create_vmm_instance(epoll_mgr.clone())));
|
||||
let mut vservice = VmmService::new(from_api, to_api);
|
||||
|
Loading…
Reference in New Issue
Block a user