Skip to content

Commit

Permalink
fix(quic): use bytes from compio-buf
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Sep 16, 2024
1 parent 431a1e1 commit 3eba645
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 19 deletions.
8 changes: 3 additions & 5 deletions compio-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,19 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
# Workspace dependencies
compio-io = { workspace = true }
compio-buf = { workspace = true }
compio-buf = { workspace = true, features = ["bytes"] }
compio-log = { workspace = true }
compio-net = { workspace = true }
compio-runtime = { workspace = true, features = ["time"] }

quinn-proto = "0.11.3"
quinn-proto = "0.11.8"
rustls = { workspace = true }
rustls-platform-verifier = { version = "0.3.3", optional = true }
rustls-native-certs = { workspace = true, optional = true }
webpki-roots = { version = "0.26.3", optional = true }
h3 = { version = "0.0.6", optional = true }

# Utils
bytes = { workspace = true }
flume = { workspace = true }
futures-util = { workspace = true }
rustc-hash = "2.0.0"
Expand All @@ -44,7 +43,6 @@ windows-sys = { workspace = true, features = ["Win32_Networking_WinSock"] }
libc = { workspace = true }

[dev-dependencies]
compio-buf = { workspace = true, features = ["bytes"] }
compio-dispatcher = { workspace = true }
compio-driver = { workspace = true }
compio-fs = { workspace = true }
Expand All @@ -53,7 +51,7 @@ compio-runtime = { workspace = true, features = ["criterion"] }

criterion = { workspace = true, features = ["async_tokio"] }
http = "1.1.0"
quinn = "0.11.3"
quinn = "0.11.5"
rand = { workspace = true }
rcgen = "0.13.1"
socket2 = { workspace = true, features = ["all"] }
Expand Down
2 changes: 1 addition & 1 deletion compio-quic/benches/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
time::Instant,
};

use bytes::Bytes;
use compio_buf::bytes::Bytes;
use criterion::{criterion_group, criterion_main, Bencher, BenchmarkId, Criterion, Throughput};
use futures_util::{stream::FuturesUnordered, StreamExt};
use rand::{thread_rng, RngCore};
Expand Down
2 changes: 1 addition & 1 deletion compio-quic/examples/http3-client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
str::FromStr,
};

use bytes::Buf;
use compio_buf::bytes::Buf;
use compio_io::AsyncWriteAtExt;
use compio_net::ToSocketAddrsAsync;
use compio_quic::ClientBuilder;
Expand Down
2 changes: 1 addition & 1 deletion compio-quic/examples/http3-server.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bytes::Bytes;
use compio_buf::bytes::Bytes;
use compio_quic::ServerBuilder;
use http::{HeaderMap, Response};
use tracing_subscriber::EnvFilter;
Expand Down
5 changes: 2 additions & 3 deletions compio-quic/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ use std::{
time::{Duration, Instant},
};

use bytes::Bytes;
use compio_buf::BufResult;
use compio_buf::{bytes::Bytes, BufResult};
use compio_log::{error, Instrument};
use compio_runtime::JoinHandle;
use flume::{Receiver, Sender};
Expand Down Expand Up @@ -984,7 +983,7 @@ pub enum OpenStreamError {

#[cfg(feature = "h3")]
pub(crate) mod h3_impl {
use bytes::{Buf, BytesMut};
use compio_buf::bytes::{Buf, BytesMut};
use futures_util::ready;
use h3::{
error::Code,
Expand Down
3 changes: 1 addition & 2 deletions compio-quic/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use std::{
time::Instant,
};

use bytes::Bytes;
use compio_buf::BufResult;
use compio_buf::{bytes::Bytes, BufResult};
use compio_log::{error, Instrument};
use compio_net::{ToSocketAddrsAsync, UdpSocket};
use compio_runtime::JoinHandle;
Expand Down
6 changes: 4 additions & 2 deletions compio-quic/src/recv_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ use std::{
task::{Context, Poll},
};

use bytes::{BufMut, Bytes};
use compio_buf::{BufResult, IoBufMut};
use compio_buf::{
bytes::{BufMut, Bytes},
BufResult, IoBufMut,
};
use compio_io::AsyncRead;
use futures_util::{future::poll_fn, ready};
use quinn_proto::{Chunk, Chunks, ClosedStream, ReadableError, StreamId, VarInt};
Expand Down
5 changes: 2 additions & 3 deletions compio-quic/src/send_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::{
task::{Context, Poll},
};

use bytes::Bytes;
use compio_buf::{BufResult, IoBuf};
use compio_buf::{bytes::Bytes, BufResult, IoBuf};
use compio_io::AsyncWrite;
use futures_util::{future::poll_fn, ready};
use quinn_proto::{ClosedStream, FinishError, StreamId, VarInt, Written};
Expand Down Expand Up @@ -368,7 +367,7 @@ impl futures_util::AsyncWrite for SendStream {

#[cfg(feature = "h3")]
pub(crate) mod h3_impl {
use bytes::Buf;
use compio_buf::bytes::Buf;
use h3::quic::{self, Error, WriteBuf};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion compio-quic/tests/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
};

use bytes::Bytes;
use compio_buf::bytes::Bytes;
use compio_quic::{Endpoint, RecvStream, SendStream, TransportConfig};

mod common;
Expand Down

0 comments on commit 3eba645

Please sign in to comment.