Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/all_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

env:
CARGO_TERM_COLOR: always

jobs:
upgrade:
build:
name: Build on ${{ matrix.os }} (${{ matrix.toolchain }})
runs-on: ${{ matrix.os }}

Expand All @@ -22,8 +25,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- id: setup
name: Setup Toolchain
- name: Setup Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
Expand All @@ -32,4 +34,4 @@ jobs:
run: cargo test --all-features --verbose

- name: Build project
run: cargo build --release --verbose
run: cargo build --release --verbose
26 changes: 13 additions & 13 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "torrust-actix"
version = "4.0.15"
version = "4.0.16"
edition = "2024"
license = "AGPL-3.0"
authors = [
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Run the code using `--help` argument for using in your enironment:
```bash
./target/release/torrust-actix --help
```
Before you can run the server, you need to either have persietency turned off, and when enabled, make sure your database is created and working. See the help argument above how to fix your setup as you wish.
Before you can run the server, you need to either have persistence turned off, and when enabled, make sure your database is created and working. See the help argument above how to fix your setup as you wish.

Swagger UI is introduced, and when enabled in the configuration, is accessible through the API via `/swagger-ui/`.

Expand Down Expand Up @@ -167,11 +167,25 @@ HTTP_0_TLS_CONNECTION_RATE <UINT64>

UDP_0_ENABLED <true | false>
UDP_0_BIND_ADDRESS <STRING>
UDP_0_THREADS <UINT64>
UDP_0_UDP_THREADS <UINT64>
UDP_0_WORKER_THREADS <UINT64>
UDP_0_RECEIVE_BUFFER_SIZE <UINT64>
UDP_0_SEND_BUFFER_SIZE <UINT64>
UDP_0_REUSE_ADDRESS <true | false>
```

### ChangeLog

#### v4.0.16
* Small debug and hotfixes
* Fixed the unit test that somehow failed
* Updated this readme file

#### v4.0.15
* More code optimizations thanks to AI scanning further
* UDP performance tweaks (some new config options added)
* Added an initial unit testing for checking if all functions and features work as expected

#### v4.0.14
* Code optimizations thanks to AI scanning
* Huge memory and CPU consumption improvement for UDP, using offloading
Expand Down
2 changes: 0 additions & 2 deletions benches/tracker_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ fn bench_get_peers_with_limit(c: &mut Criterion) {
let tracker = rt.block_on(create_tracker());
let info_hash = random_info_hash();


for i in 0..1000 {
let peer_id = random_peer_id();
let peer = create_test_peer(IpAddr::V4(Ipv4Addr::new(10, 0, (i / 256) as u8, (i % 256) as u8)), 6881, peer_id);
Expand Down Expand Up @@ -157,7 +156,6 @@ fn bench_peer_filtering_ipv4_vs_ipv6(c: &mut Criterion) {
let tracker = rt.block_on(create_tracker());
let info_hash = random_info_hash();


for i in 0..500 {
let peer_id = random_peer_id();
let peer = if i % 2 == 0 {
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM rust:alpine

RUN apk add git musl-dev curl pkgconfig openssl-dev openssl-libs-static
RUN git clone https://github.com/Power2All/torrust-actix.git /app/torrust-actix
RUN cd /app/torrust-actix && git checkout tags/v4.0.15
RUN cd /app/torrust-actix && git checkout tags/v4.0.16
WORKDIR /app/torrust-actix
RUN cd /app/torrust-actix
RUN cargo build --release && rm -Rf target/release/.fingerprint target/release/build target/release/deps target/release/examples target/release/incremental
Expand Down
4 changes: 2 additions & 2 deletions docker/build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off

docker build -t power2all/torrust-actix:v4.0.15 -t power2all/torrust-actix:latest .
docker push power2all/torrust-actix:v4.0.15
docker build -t power2all/torrust-actix:v4.0.16 -t power2all/torrust-actix:latest .
docker push power2all/torrust-actix:v4.0.16
docker push power2all/torrust-actix:latest
1 change: 1 addition & 0 deletions src/http/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use std::time::Duration;
pub fn http_service_cors() -> Cors
{
Cors::default()
.allow_any_origin()
.send_wildcard()
.allowed_methods(vec!["GET"])
.allowed_headers(vec![http::header::X_FORWARDED_FOR, http::header::ACCEPT])
Expand Down
1 change: 0 additions & 1 deletion src/udp/impls/parse_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ impl ParsePool {
});
}


let runtime = self.udp_runtime.clone();
std::mem::forget(runtime);
}
Expand Down
8 changes: 6 additions & 2 deletions src/udp/impls/udp_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,14 @@ impl UdpServer {
#[tracing::instrument(level = "debug")]
pub async fn get_connection_id(remote_address: &SocketAddr) -> ConnectionId {
use std::hash::{DefaultHasher, Hasher};
use std::time::Instant;
use std::time::{SystemTime, UNIX_EPOCH};

let mut hasher = DefaultHasher::new();
hasher.write_u64(Instant::now().elapsed().as_nanos() as u64);
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_nanos() as u64;
hasher.write_u64(timestamp);
hasher.write_u16(remote_address.port());
if let std::net::IpAddr::V4(ipv4) = remote_address.ip() {
hasher.write(&ipv4.octets());
Expand Down
Loading