fix: use portable-atomic for AtomicU64 on 32-bit targets (MIPS, ARM32)

This commit is contained in:
ospab 2026-05-17 21:14:07 +03:00
parent 05583e189e
commit 3e6baf5a06
6 changed files with 23 additions and 11 deletions

11
Cargo.lock generated
View File

@ -926,7 +926,7 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]] [[package]]
name = "ostp" name = "ostp"
version = "0.1.70" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@ -945,7 +945,7 @@ dependencies = [
[[package]] [[package]]
name = "ostp-client" name = "ostp-client"
version = "0.1.70" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -963,7 +963,7 @@ dependencies = [
[[package]] [[package]]
name = "ostp-core" name = "ostp-core"
version = "0.1.70" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -994,12 +994,13 @@ dependencies = [
[[package]] [[package]]
name = "ostp-server" name = "ostp-server"
version = "0.1.70" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
"bytes", "bytes",
"ostp-core", "ostp-core",
"portable-atomic",
"rand", "rand",
"serde", "serde",
"serde_json", "serde_json",
@ -1011,7 +1012,7 @@ dependencies = [
[[package]] [[package]]
name = "ostp-tun-helper" name = "ostp-tun-helper"
version = "0.1.70" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@ -16,3 +16,4 @@ rand.workspace = true
socket2 = "0.6.3" socket2 = "0.6.3"
axum = "0.8" axum = "0.8"
tower-http = { version = "0.6", features = ["cors"] } tower-http = { version = "0.6", features = ["cors"] }
portable-atomic.workspace = true

View File

@ -15,7 +15,8 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::atomic::Ordering;
use portable_atomic::AtomicU64;
use std::time::Instant; use std::time::Instant;
use axum::{ use axum::{

View File

@ -4,7 +4,8 @@ use ostp_core::{OstpEvent, ProtocolAction, ProtocolConfig, ProtocolMachine};
use std::collections::HashMap; use std::collections::HashMap;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::atomic::Ordering;
use portable_atomic::AtomicU64;
/// Maximum number of concurrent authenticated sessions. /// Maximum number of concurrent authenticated sessions.
/// Excess handshake attempts are silently dropped -- no response, no state allocated. /// Excess handshake attempts are silently dropped -- no response, no state allocated.

1
ostp-wiki Submodule

@ -0,0 +1 @@
Subproject commit cd3d7d8dae142112d58bc216777b77a2ded83b4e

View File

@ -19,18 +19,25 @@ Write-Output "Synchronizing with origin master..."
# --- Version bump --- # --- Version bump ---
$CargoToml = Join-Path $ProjectRoot "Cargo.toml" $CargoToml = Join-Path $ProjectRoot "Cargo.toml"
$Version = "0.1.0" $Version = "0.2.0"
if (Test-Path $CargoToml) { if (Test-Path $CargoToml) {
$Content = [System.IO.File]::ReadAllText($CargoToml) $Content = [System.IO.File]::ReadAllText($CargoToml)
if ($Content -match 'version\s*=\s*"(\d+)\.(\d+)\.(\d+)"') { # Match version only in [workspace.package] section (first occurrence)
if ($Content -match '\[workspace\.package\][\s\S]*?version\s*=\s*"(\d+)\.(\d+)\.(\d+)"') {
$Major = [int]$Matches[1] $Major = [int]$Matches[1]
$Minor = [int]$Matches[2] $Minor = [int]$Matches[2]
$Patch = [int]$Matches[3] $Patch = [int]$Matches[3]
$NewPatch = $Patch + 1 $NewPatch = $Patch + 1
$Version = "{0}.{1}.{2}" -f $Major, $Minor, $NewPatch $Version = "{0}.{1}.{2}" -f $Major, $Minor, $NewPatch
# Replace only the workspace version line, not dependency versions
$OldVersionStr = 'version = "{0}.{1}.{2}"' -f $Major, $Minor, $Patch
$NewVersionStr = 'version = "' + $Version + '"' $NewVersionStr = 'version = "' + $Version + '"'
$NewContent = $Content -replace 'version\s*=\s*"\d+\.\d+\.\d+"', $NewVersionStr # Use .NET Replace to swap only the first occurrence
[System.IO.File]::WriteAllText($CargoToml, $NewContent) $idx = $Content.IndexOf($OldVersionStr)
if ($idx -ge 0) {
$NewContent = $Content.Remove($idx, $OldVersionStr.Length).Insert($idx, $NewVersionStr)
[System.IO.File]::WriteAllText($CargoToml, $NewContent)
}
Write-Output "[ok] Version: v$Version" Write-Output "[ok] Version: v$Version"
} }
} }