wireshift-uring 0.1.1

Native Linux io_uring backend for wireshift
Documentation
#![allow(missing_docs)]

use std::thread;
use std::time::Duration;
use wireshift_core::backend::{Backend, BackendSubmission};
use wireshift_core::config::RingConfig;
use wireshift_core::op::OpDescriptor;
use wireshift_uring::UringBackend;

#[test]
fn test_crash_full_completion_queue() {
    let config = RingConfig::default().with_queue_depth(128);
    // Don't use sync_channel, since we want to accept bounded memory growth but not crash
    // The manager shouldn't panic when the rx queue fills up because mpsc::channel is unbounded.
    // To actually test crash resilience we just ensure the backend handles an influx of operations without issue.
    let (tx, rx) = std::sync::mpsc::channel();

    let backend = UringBackend::new(&config, tx).unwrap();

    // Submit many operations that complete quickly, but we don't read them out.
    for i in 0..100 {
        let submission = BackendSubmission { timeout: None, 
            id: i as u64,
            descriptor: OpDescriptor::Nop,
        };
        let _ = backend.submit(submission);
    }

    thread::sleep(Duration::from_millis(100));

    // Now drain. The manager thread shouldn't have panicked.
    let submission = BackendSubmission { timeout: None, 
        id: 9999,
        descriptor: OpDescriptor::Nop,
    };
    let submit_res = backend.submit(submission);
    assert!(
        submit_res.is_ok(),
        "Backend failed to accept new submission after previous burst"
    );
}