Skip to content

Commit

Permalink
Use memmap2 instead of memmap, enable rustls on windows, fix typo…
Browse files Browse the repository at this point in the history
…s in openssl api (#206)
  • Loading branch information
ozgrakkurt committed Apr 18, 2023
1 parent e97957e commit 82063ce
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 25 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ concurrency:
cancel-in-progress: true

jobs:
test-windows:
name: Run tests on Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
key: windows-latest-test
- name: Test
run: cargo test --features task,subscriber,fixture,task_unstable,io,sync,future,net,tls,rust_tls,timer,fs,zero_copy,mmap,retry,doomsday
test:
name: Check ${{ matrix.check }} on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -97,6 +112,7 @@ jobs:
done:
name: Done
needs:
- test-windows
- test
- wasm_test
runs-on: ubuntu-latest
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Release Notes

## 0.5.0
* Move to `memmap2` because `memmap` is unmaintained.
* Enable `rustls` on `windows`
* fixed typos in `openssl` api. ([#175](https://github.com/infinyon/future-aio/issues/175))

([#206](https://github.com/infinyon/future-aio/pull/206))

## 0.4.5
* Doomsday timer to ensure crash ([#196](https://github.com/infinyon/future-aio/pull/196))

## 0.4.4
* update rustls

## 0.4.3
* expose futures

## 0.4.2
* re-export async_std::sync structs

## 0.4.1
* Make tcp connector `Send` for `wasm32` ([#165](https://github.com/infinyon/future-aio/pull/165))

Expand Down
11 changes: 5 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-future"
version = "0.4.5"
version = "0.5.0"
edition = "2021"
authors = ["Fluvio Contributors <[email protected]>"]
description = "I/O futures for Fluvio project"
Expand Down Expand Up @@ -46,7 +46,7 @@ openssl_tls = [
timer = ["async-io", "pin-project", "futures-lite"]
fs = ["async-fs", "futures-lite", "pin-utils", "async-trait"]
zero_copy = ["nix", "task_unstable"]
mmap = ["fs", "memmap", "task_unstable"]
mmap = ["fs", "memmap2", "task_unstable"]
retry = []
doomsday = []

Expand All @@ -71,7 +71,7 @@ fluvio-async-tls = { version = "0.3.0", optional = true }
async-std = { version = "1.6.2", default-features = false, optional = true }
async-io = { version = "1.1.2", optional = true }
async-net = { version = "1.6.0", optional = true }
memmap = { version = "0.7.0", optional = true }
memmap2 = { version = "0.5", optional = true }
openssl = { version = "0.10.35", optional = true }
async-native-tls = { version = "0.4.0", optional = true }
native-tls = { version = "0.2.4", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions src/fs/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::sync::RwLockReadGuard;
use std::sync::RwLockWriteGuard;

use async_fs::File;
use memmap::Mmap;
use memmap::MmapMut;
use memmap2::Mmap;
use memmap2::MmapMut;

use crate::task::spawn_blocking;

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ pub mod zero_copy;
#[cfg(feature = "net")]
pub mod net;

#[cfg(all(unix, feature = "rust_tls"))]
#[cfg(all(any(unix, windows), feature = "rust_tls"))]
pub mod rust_tls;

#[cfg(all(unix, feature = "rust_tls", not(feature = "native2_tls")))]
#[cfg(all(any(unix, windows), feature = "rust_tls", not(feature = "native2_tls")))]
pub use rust_tls as tls;

#[cfg(all(any(unix, windows), feature = "native2_tls"))]
Expand Down
4 changes: 2 additions & 2 deletions src/openssl/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ pub struct TlsConnectorBuilder {
}

impl TlsConnectorBuilder {
pub fn with_hostname_vertification_disabled(mut self) -> Result<TlsConnectorBuilder> {
pub fn with_hostname_verification_disabled(mut self) -> Result<TlsConnectorBuilder> {
self.verify_hostname = false;
Ok(self)
}

pub fn with_certificate_vertification_disabled(mut self) -> Result<TlsConnectorBuilder> {
pub fn with_certificate_verification_disabled(mut self) -> Result<TlsConnectorBuilder> {
self.inner.set_verify(ssl::SslVerifyMode::NONE);
Ok(self)
}
Expand Down
4 changes: 2 additions & 2 deletions src/openssl/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn test_tls() -> Result<(), TlsError> {
)?
.build(),
TlsConnector::builder()?
.with_hostname_vertification_disabled()?
.with_hostname_verification_disabled()?
.with_ca_from_pem_file(INTERMEDIATE_CA_PATH)?
.build(),
)
Expand All @@ -58,7 +58,7 @@ async fn test_tls() -> Result<(), TlsError> {
)?
.build(),
TlsConnector::builder()?
.with_hostname_vertification_disabled()?
.with_hostname_verification_disabled()?
.with_ca_from_pem_file(CA_PATH)?
.build(),
)
Expand Down
14 changes: 6 additions & 8 deletions src/rust_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,17 @@ mod cert {
}

mod connector {

use std::io::Error as IoError;

use std::io::ErrorKind;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;

use async_rustls::rustls::ServerName;
use async_trait::async_trait;
use log::debug;

use crate::net::{
BoxReadConnection, BoxWriteConnection, DomainConnector, SplitConnection, TcpDomainConnector,
AsConnectionFd, BoxReadConnection, BoxWriteConnection, ConnectionFd, DomainConnector,
SplitConnection, TcpDomainConnector,
};

use super::TcpStream;
Expand All @@ -135,9 +133,9 @@ mod connector {
async fn connect(
&self,
domain: &str,
) -> Result<(BoxWriteConnection, BoxReadConnection, RawFd), IoError> {
) -> Result<(BoxWriteConnection, BoxReadConnection, ConnectionFd), IoError> {
let tcp_stream = TcpStream::connect(domain).await?;
let fd = tcp_stream.as_raw_fd();
let fd = tcp_stream.as_connection_fd();
let (write, read) = self
.0
.connect(
Expand Down Expand Up @@ -180,10 +178,10 @@ mod connector {
async fn connect(
&self,
addr: &str,
) -> Result<(BoxWriteConnection, BoxReadConnection, RawFd), IoError> {
) -> Result<(BoxWriteConnection, BoxReadConnection, ConnectionFd), IoError> {
debug!("connect to tls addr: {}", addr);
let tcp_stream = TcpStream::connect(addr).await?;
let fd = tcp_stream.as_raw_fd();
let fd = tcp_stream.as_connection_fd();
debug!("connect to tls domain: {}", self.domain);
let (write, read) = self
.connector
Expand Down

0 comments on commit 82063ce

Please sign in to comment.