Skip to content

Commit

Permalink
.github: test min Rust version and latest stable (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Jun 24, 2022
1 parent 0a0db46 commit 12f5534
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
38 changes: 27 additions & 11 deletions crates/sctp/.github/workflows/cargo.yml
Expand Up @@ -10,39 +10,55 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build and test
check_and_test:
name: Check and test
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
toolchain:
- 1.56.1 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
- stable
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
command: check
- uses: actions-rs/cargo@v1
with:
command: test

rustfmt_and_clippy:
name: Check rustfmt style && run clippy
name: Check rustfmt style and run clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy, rustfmt
override: true
- name: Cache cargo registry
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
- name: Check formating
uses: actions-rs/cargo@v1
with:
Expand All @@ -56,7 +72,7 @@ jobs:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions crates/sctp/src/queue/reassembly_queue.rs
Expand Up @@ -5,7 +5,7 @@ use crate::error::{Error, Result};

use std::cmp::Ordering;

fn sort_chunks_by_tsn(c: &mut Vec<ChunkPayloadData>) {
fn sort_chunks_by_tsn(c: &mut [ChunkPayloadData]) {
c.sort_by(|a, b| {
if sna32lt(a.tsn, b.tsn) {
Ordering::Less
Expand All @@ -15,7 +15,7 @@ fn sort_chunks_by_tsn(c: &mut Vec<ChunkPayloadData>) {
});
}

fn sort_chunks_by_ssn(c: &mut Vec<ChunkSet>) {
fn sort_chunks_by_ssn(c: &mut [ChunkSet]) {
c.sort_by(|a, b| {
if sna16lt(a.ssn, b.ssn) {
Ordering::Less
Expand Down
8 changes: 4 additions & 4 deletions crates/sctp/src/stream/mod.rs
Expand Up @@ -375,10 +375,10 @@ impl Stream {
self.write_shutdown.store(true, Ordering::SeqCst);
}

if how == Shutdown::Read || how == Shutdown::Both {
if !self.read_shutdown.swap(true, Ordering::SeqCst) {
self.read_notifier.notify_waiters();
}
if (how == Shutdown::Read || how == Shutdown::Both)
&& !self.read_shutdown.swap(true, Ordering::SeqCst)
{
self.read_notifier.notify_waiters();
}

if how == Shutdown::Both
Expand Down

0 comments on commit 12f5534

Please sign in to comment.