[style](trx-rs): apply rustfmt formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -337,7 +337,6 @@ pub struct OwnerInfo {
|
|||||||
pub ais_vessel_url_base: Option<String>,
|
pub ais_vessel_url_base: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Virtual channel audio management.
|
/// Virtual channel audio management.
|
||||||
pub struct VChanContext {
|
pub struct VChanContext {
|
||||||
/// Per-virtual-channel Opus audio senders.
|
/// Per-virtual-channel Opus audio senders.
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ pub async fn events(
|
|||||||
let active_rig_id = query.remote.clone().filter(|s| !s.is_empty()).or_else(|| {
|
let active_rig_id = query.remote.clone().filter(|s| !s.is_empty()).or_else(|| {
|
||||||
context
|
context
|
||||||
.routing
|
.routing
|
||||||
.active_rig_id
|
.active_rig_id
|
||||||
.lock()
|
.lock()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|g| g.clone())
|
.and_then(|g| g.clone())
|
||||||
@@ -425,7 +425,7 @@ pub async fn events(
|
|||||||
let rig_id_opt = session_rig_mgr.get_rig(session_id).or_else(|| {
|
let rig_id_opt = session_rig_mgr.get_rig(session_id).or_else(|| {
|
||||||
context
|
context
|
||||||
.routing
|
.routing
|
||||||
.active_rig_id
|
.active_rig_id
|
||||||
.lock()
|
.lock()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|g| g.clone())
|
.and_then(|g| g.clone())
|
||||||
@@ -448,9 +448,9 @@ pub async fn events(
|
|||||||
rig_id_opt.as_deref(),
|
rig_id_opt.as_deref(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
serde_json::to_string(&combined).ok().map(|json| {
|
serde_json::to_string(&combined)
|
||||||
Ok::<Bytes, Error>(Bytes::from(format!("data: {json}\n\n")))
|
.ok()
|
||||||
})
|
.map(|json| Ok::<Bytes, Error>(Bytes::from(format!("data: {json}\n\n"))))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1357,7 +1357,12 @@ struct SatPassesResponse {
|
|||||||
/// are not yet available.
|
/// are not yet available.
|
||||||
#[get("/sat_passes")]
|
#[get("/sat_passes")]
|
||||||
pub async fn sat_passes(context: web::Data<Arc<FrontendRuntimeContext>>) -> impl Responder {
|
pub async fn sat_passes(context: web::Data<Arc<FrontendRuntimeContext>>) -> impl Responder {
|
||||||
let cached = context.routing.sat_passes.read().ok().and_then(|g| g.clone());
|
let cached = context
|
||||||
|
.routing
|
||||||
|
.sat_passes
|
||||||
|
.read()
|
||||||
|
.ok()
|
||||||
|
.and_then(|g| g.clone());
|
||||||
match cached {
|
match cached {
|
||||||
Some(result) => {
|
Some(result) => {
|
||||||
let error = match result.tle_source {
|
let error = match result.tle_source {
|
||||||
@@ -1612,7 +1617,10 @@ fn static_asset_response(
|
|||||||
if val == etag || val == "*" {
|
if val == etag || val == "*" {
|
||||||
return HttpResponse::NotModified()
|
return HttpResponse::NotModified()
|
||||||
.insert_header((header::ETAG, etag.to_owned()))
|
.insert_header((header::ETAG, etag.to_owned()))
|
||||||
.insert_header((header::CACHE_CONTROL, "public, max-age=86400, must-revalidate"))
|
.insert_header((
|
||||||
|
header::CACHE_CONTROL,
|
||||||
|
"public, max-age=86400, must-revalidate",
|
||||||
|
))
|
||||||
.finish();
|
.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1621,7 +1629,10 @@ fn static_asset_response(
|
|||||||
.insert_header((header::CONTENT_TYPE, content_type))
|
.insert_header((header::CONTENT_TYPE, content_type))
|
||||||
.insert_header((header::CONTENT_ENCODING, "gzip"))
|
.insert_header((header::CONTENT_ENCODING, "gzip"))
|
||||||
.insert_header((header::ETAG, etag.to_owned()))
|
.insert_header((header::ETAG, etag.to_owned()))
|
||||||
.insert_header((header::CACHE_CONTROL, "public, max-age=86400, must-revalidate"))
|
.insert_header((
|
||||||
|
header::CACHE_CONTROL,
|
||||||
|
"public, max-age=86400, must-revalidate",
|
||||||
|
))
|
||||||
.body(Bytes::copy_from_slice(gz_bytes))
|
.body(Bytes::copy_from_slice(gz_bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1652,9 +1663,21 @@ macro_rules! define_gz_cache {
|
|||||||
define_gz_cache!(gz_index_html, status::index_html(), "index.html");
|
define_gz_cache!(gz_index_html, status::index_html(), "index.html");
|
||||||
define_gz_cache!(gz_style_css, status::STYLE_CSS, "style.css");
|
define_gz_cache!(gz_style_css, status::STYLE_CSS, "style.css");
|
||||||
define_gz_cache!(gz_app_js, status::APP_JS, "app.js");
|
define_gz_cache!(gz_app_js, status::APP_JS, "app.js");
|
||||||
define_gz_cache!(gz_decode_history_worker_js, status::DECODE_HISTORY_WORKER_JS, "decode-history-worker.js");
|
define_gz_cache!(
|
||||||
define_gz_cache!(gz_webgl_renderer_js, status::WEBGL_RENDERER_JS, "webgl-renderer.js");
|
gz_decode_history_worker_js,
|
||||||
define_gz_cache!(gz_leaflet_ais_tracksymbol_js, status::LEAFLET_AIS_TRACKSYMBOL_JS, "leaflet-ais-tracksymbol.js");
|
status::DECODE_HISTORY_WORKER_JS,
|
||||||
|
"decode-history-worker.js"
|
||||||
|
);
|
||||||
|
define_gz_cache!(
|
||||||
|
gz_webgl_renderer_js,
|
||||||
|
status::WEBGL_RENDERER_JS,
|
||||||
|
"webgl-renderer.js"
|
||||||
|
);
|
||||||
|
define_gz_cache!(
|
||||||
|
gz_leaflet_ais_tracksymbol_js,
|
||||||
|
status::LEAFLET_AIS_TRACKSYMBOL_JS,
|
||||||
|
"leaflet-ais-tracksymbol.js"
|
||||||
|
);
|
||||||
define_gz_cache!(gz_ais_js, status::AIS_JS, "ais.js");
|
define_gz_cache!(gz_ais_js, status::AIS_JS, "ais.js");
|
||||||
define_gz_cache!(gz_vdes_js, status::VDES_JS, "vdes.js");
|
define_gz_cache!(gz_vdes_js, status::VDES_JS, "vdes.js");
|
||||||
define_gz_cache!(gz_aprs_js, status::APRS_JS, "aprs.js");
|
define_gz_cache!(gz_aprs_js, status::APRS_JS, "aprs.js");
|
||||||
@@ -1667,8 +1690,16 @@ define_gz_cache!(gz_cw_js, status::CW_JS, "cw.js");
|
|||||||
define_gz_cache!(gz_sat_js, status::SAT_JS, "sat.js");
|
define_gz_cache!(gz_sat_js, status::SAT_JS, "sat.js");
|
||||||
define_gz_cache!(gz_bookmarks_js, status::BOOKMARKS_JS, "bookmarks.js");
|
define_gz_cache!(gz_bookmarks_js, status::BOOKMARKS_JS, "bookmarks.js");
|
||||||
define_gz_cache!(gz_scheduler_js, status::SCHEDULER_JS, "scheduler.js");
|
define_gz_cache!(gz_scheduler_js, status::SCHEDULER_JS, "scheduler.js");
|
||||||
define_gz_cache!(gz_sat_scheduler_js, status::SAT_SCHEDULER_JS, "sat-scheduler.js");
|
define_gz_cache!(
|
||||||
define_gz_cache!(gz_background_decode_js, status::BACKGROUND_DECODE_JS, "background-decode.js");
|
gz_sat_scheduler_js,
|
||||||
|
status::SAT_SCHEDULER_JS,
|
||||||
|
"sat-scheduler.js"
|
||||||
|
);
|
||||||
|
define_gz_cache!(
|
||||||
|
gz_background_decode_js,
|
||||||
|
status::BACKGROUND_DECODE_JS,
|
||||||
|
"background-decode.js"
|
||||||
|
);
|
||||||
define_gz_cache!(gz_vchan_js, status::VCHAN_JS, "vchan.js");
|
define_gz_cache!(gz_vchan_js, status::VCHAN_JS, "vchan.js");
|
||||||
|
|
||||||
/// A bookmark with its owning scope tag for the list response.
|
/// A bookmark with its owning scope tag for the list response.
|
||||||
@@ -2308,115 +2339,210 @@ async fn style_css(req: HttpRequest) -> impl Responder {
|
|||||||
#[get("/app.js")]
|
#[get("/app.js")]
|
||||||
async fn app_js(req: HttpRequest) -> impl Responder {
|
async fn app_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_app_js();
|
let c = gz_app_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/decode-history-worker.js")]
|
#[get("/decode-history-worker.js")]
|
||||||
async fn decode_history_worker_js(req: HttpRequest) -> impl Responder {
|
async fn decode_history_worker_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_decode_history_worker_js();
|
let c = gz_decode_history_worker_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/webgl-renderer.js")]
|
#[get("/webgl-renderer.js")]
|
||||||
async fn webgl_renderer_js(req: HttpRequest) -> impl Responder {
|
async fn webgl_renderer_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_webgl_renderer_js();
|
let c = gz_webgl_renderer_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/leaflet-ais-tracksymbol.js")]
|
#[get("/leaflet-ais-tracksymbol.js")]
|
||||||
async fn leaflet_ais_tracksymbol_js(req: HttpRequest) -> impl Responder {
|
async fn leaflet_ais_tracksymbol_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_leaflet_ais_tracksymbol_js();
|
let c = gz_leaflet_ais_tracksymbol_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/aprs.js")]
|
#[get("/aprs.js")]
|
||||||
async fn aprs_js(req: HttpRequest) -> impl Responder {
|
async fn aprs_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_aprs_js();
|
let c = gz_aprs_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/hf-aprs.js")]
|
#[get("/hf-aprs.js")]
|
||||||
async fn hf_aprs_js(req: HttpRequest) -> impl Responder {
|
async fn hf_aprs_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_hf_aprs_js();
|
let c = gz_hf_aprs_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ais.js")]
|
#[get("/ais.js")]
|
||||||
async fn ais_js(req: HttpRequest) -> impl Responder {
|
async fn ais_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_ais_js();
|
let c = gz_ais_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/vdes.js")]
|
#[get("/vdes.js")]
|
||||||
async fn vdes_js(req: HttpRequest) -> impl Responder {
|
async fn vdes_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_vdes_js();
|
let c = gz_vdes_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft8.js")]
|
#[get("/ft8.js")]
|
||||||
async fn ft8_js(req: HttpRequest) -> impl Responder {
|
async fn ft8_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_ft8_js();
|
let c = gz_ft8_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft4.js")]
|
#[get("/ft4.js")]
|
||||||
async fn ft4_js(req: HttpRequest) -> impl Responder {
|
async fn ft4_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_ft4_js();
|
let c = gz_ft4_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/ft2.js")]
|
#[get("/ft2.js")]
|
||||||
async fn ft2_js(req: HttpRequest) -> impl Responder {
|
async fn ft2_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_ft2_js();
|
let c = gz_ft2_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/wspr.js")]
|
#[get("/wspr.js")]
|
||||||
async fn wspr_js(req: HttpRequest) -> impl Responder {
|
async fn wspr_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_wspr_js();
|
let c = gz_wspr_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/cw.js")]
|
#[get("/cw.js")]
|
||||||
async fn cw_js(req: HttpRequest) -> impl Responder {
|
async fn cw_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_cw_js();
|
let c = gz_cw_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/sat.js")]
|
#[get("/sat.js")]
|
||||||
async fn sat_js(req: HttpRequest) -> impl Responder {
|
async fn sat_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_sat_js();
|
let c = gz_sat_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/bookmarks.js")]
|
#[get("/bookmarks.js")]
|
||||||
async fn bookmarks_js(req: HttpRequest) -> impl Responder {
|
async fn bookmarks_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_bookmarks_js();
|
let c = gz_bookmarks_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/scheduler.js")]
|
#[get("/scheduler.js")]
|
||||||
async fn scheduler_js(req: HttpRequest) -> impl Responder {
|
async fn scheduler_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_scheduler_js();
|
let c = gz_scheduler_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/sat-scheduler.js")]
|
#[get("/sat-scheduler.js")]
|
||||||
async fn sat_scheduler_js(req: HttpRequest) -> impl Responder {
|
async fn sat_scheduler_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_sat_scheduler_js();
|
let c = gz_sat_scheduler_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/background-decode.js")]
|
#[get("/background-decode.js")]
|
||||||
async fn background_decode_js(req: HttpRequest) -> impl Responder {
|
async fn background_decode_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_background_decode_js();
|
let c = gz_background_decode_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/vchan.js")]
|
#[get("/vchan.js")]
|
||||||
async fn vchan_js(req: HttpRequest) -> impl Responder {
|
async fn vchan_js(req: HttpRequest) -> impl Responder {
|
||||||
let c = gz_vchan_js();
|
let c = gz_vchan_js();
|
||||||
static_asset_response(&req, "application/javascript; charset=utf-8", &c.gz, &c.etag)
|
static_asset_response(
|
||||||
|
&req,
|
||||||
|
"application/javascript; charset=utf-8",
|
||||||
|
&c.gz,
|
||||||
|
&c.etag,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generic query extractor for endpoints that only need the optional remote.
|
/// Generic query extractor for endpoints that only need the optional remote.
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ fn record_ais(context: &FrontendRuntimeContext, mut msg: AisMessage) {
|
|||||||
}
|
}
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ais
|
.decode_history
|
||||||
|
.ais
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ais history mutex poisoned");
|
.expect("ais history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -139,7 +140,8 @@ fn record_vdes(context: &FrontendRuntimeContext, mut msg: VdesMessage) {
|
|||||||
}
|
}
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.vdes
|
.decode_history
|
||||||
|
.vdes
|
||||||
.lock()
|
.lock()
|
||||||
.expect("vdes history mutex poisoned");
|
.expect("vdes history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -217,7 +219,8 @@ fn record_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
|||||||
}
|
}
|
||||||
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.aprs
|
.decode_history
|
||||||
|
.aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("aprs history mutex poisoned");
|
.expect("aprs history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, pkt));
|
history.push_back((Instant::now(), rig_id, pkt));
|
||||||
@@ -230,7 +233,8 @@ fn record_hf_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
|||||||
}
|
}
|
||||||
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = pkt.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.hf_aprs
|
.decode_history
|
||||||
|
.hf_aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("hf_aprs history mutex poisoned");
|
.expect("hf_aprs history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, pkt));
|
history.push_back((Instant::now(), rig_id, pkt));
|
||||||
@@ -240,7 +244,8 @@ fn record_hf_aprs(context: &FrontendRuntimeContext, mut pkt: AprsPacket) {
|
|||||||
fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
||||||
let rig_id = event.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = event.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.cw
|
.decode_history
|
||||||
|
.cw
|
||||||
.lock()
|
.lock()
|
||||||
.expect("cw history mutex poisoned");
|
.expect("cw history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, event));
|
history.push_back((Instant::now(), rig_id, event));
|
||||||
@@ -250,7 +255,8 @@ fn record_cw(context: &FrontendRuntimeContext, event: CwEvent) {
|
|||||||
fn record_ft8(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
fn record_ft8(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft8
|
.decode_history
|
||||||
|
.ft8
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft8 history mutex poisoned");
|
.expect("ft8 history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -260,7 +266,8 @@ fn record_ft8(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
|||||||
fn record_ft4(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
fn record_ft4(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft4
|
.decode_history
|
||||||
|
.ft4
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft4 history mutex poisoned");
|
.expect("ft4 history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -270,7 +277,8 @@ fn record_ft4(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
|||||||
fn record_ft2(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
fn record_ft2(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft2
|
.decode_history
|
||||||
|
.ft2
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft2 history mutex poisoned");
|
.expect("ft2 history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -280,7 +288,8 @@ fn record_ft2(context: &FrontendRuntimeContext, msg: Ft8Message) {
|
|||||||
fn record_wspr(context: &FrontendRuntimeContext, msg: WsprMessage) {
|
fn record_wspr(context: &FrontendRuntimeContext, msg: WsprMessage) {
|
||||||
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
let rig_id = msg.rig_id.clone().or_else(|| active_rig_id(context));
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.wspr
|
.decode_history
|
||||||
|
.wspr
|
||||||
.lock()
|
.lock()
|
||||||
.expect("wspr history mutex poisoned");
|
.expect("wspr history mutex poisoned");
|
||||||
history.push_back((Instant::now(), rig_id, msg));
|
history.push_back((Instant::now(), rig_id, msg));
|
||||||
@@ -301,7 +310,8 @@ pub fn snapshot_aprs_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<AprsPacket> {
|
) -> Vec<AprsPacket> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.aprs
|
.decode_history
|
||||||
|
.aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("aprs history mutex poisoned");
|
.expect("aprs history mutex poisoned");
|
||||||
prune_aprs_history(context, &mut history);
|
prune_aprs_history(context, &mut history);
|
||||||
@@ -317,7 +327,8 @@ pub fn snapshot_hf_aprs_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<AprsPacket> {
|
) -> Vec<AprsPacket> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.hf_aprs
|
.decode_history
|
||||||
|
.hf_aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("hf_aprs history mutex poisoned");
|
.expect("hf_aprs history mutex poisoned");
|
||||||
prune_hf_aprs_history(context, &mut history);
|
prune_hf_aprs_history(context, &mut history);
|
||||||
@@ -340,7 +351,8 @@ pub fn snapshot_ais_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<AisMessage> {
|
) -> Vec<AisMessage> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ais
|
.decode_history
|
||||||
|
.ais
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ais history mutex poisoned");
|
.expect("ais history mutex poisoned");
|
||||||
prune_ais_history(context, &mut history);
|
prune_ais_history(context, &mut history);
|
||||||
@@ -362,7 +374,8 @@ pub fn snapshot_vdes_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<VdesMessage> {
|
) -> Vec<VdesMessage> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.vdes
|
.decode_history
|
||||||
|
.vdes
|
||||||
.lock()
|
.lock()
|
||||||
.expect("vdes history mutex poisoned");
|
.expect("vdes history mutex poisoned");
|
||||||
prune_vdes_history(context, &mut history);
|
prune_vdes_history(context, &mut history);
|
||||||
@@ -378,7 +391,8 @@ pub fn snapshot_cw_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<CwEvent> {
|
) -> Vec<CwEvent> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.cw
|
.decode_history
|
||||||
|
.cw
|
||||||
.lock()
|
.lock()
|
||||||
.expect("cw history mutex poisoned");
|
.expect("cw history mutex poisoned");
|
||||||
prune_cw_history(context, &mut history);
|
prune_cw_history(context, &mut history);
|
||||||
@@ -394,7 +408,8 @@ pub fn snapshot_ft8_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<Ft8Message> {
|
) -> Vec<Ft8Message> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft8
|
.decode_history
|
||||||
|
.ft8
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft8 history mutex poisoned");
|
.expect("ft8 history mutex poisoned");
|
||||||
prune_ft8_history(context, &mut history);
|
prune_ft8_history(context, &mut history);
|
||||||
@@ -410,7 +425,8 @@ pub fn snapshot_ft4_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<Ft8Message> {
|
) -> Vec<Ft8Message> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft4
|
.decode_history
|
||||||
|
.ft4
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft4 history mutex poisoned");
|
.expect("ft4 history mutex poisoned");
|
||||||
prune_ft4_history(context, &mut history);
|
prune_ft4_history(context, &mut history);
|
||||||
@@ -426,7 +442,8 @@ pub fn snapshot_ft2_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<Ft8Message> {
|
) -> Vec<Ft8Message> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft2
|
.decode_history
|
||||||
|
.ft2
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft2 history mutex poisoned");
|
.expect("ft2 history mutex poisoned");
|
||||||
prune_ft2_history(context, &mut history);
|
prune_ft2_history(context, &mut history);
|
||||||
@@ -442,7 +459,8 @@ pub fn snapshot_wspr_history(
|
|||||||
rig_filter: Option<&str>,
|
rig_filter: Option<&str>,
|
||||||
) -> Vec<WsprMessage> {
|
) -> Vec<WsprMessage> {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.wspr
|
.decode_history
|
||||||
|
.wspr
|
||||||
.lock()
|
.lock()
|
||||||
.expect("wspr history mutex poisoned");
|
.expect("wspr history mutex poisoned");
|
||||||
prune_wspr_history(context, &mut history);
|
prune_wspr_history(context, &mut history);
|
||||||
@@ -455,7 +473,8 @@ pub fn snapshot_wspr_history(
|
|||||||
|
|
||||||
pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.aprs
|
.decode_history
|
||||||
|
.aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("aprs history mutex poisoned");
|
.expect("aprs history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -463,7 +482,8 @@ pub fn clear_aprs_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_hf_aprs_history(context: &FrontendRuntimeContext) {
|
pub fn clear_hf_aprs_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.hf_aprs
|
.decode_history
|
||||||
|
.hf_aprs
|
||||||
.lock()
|
.lock()
|
||||||
.expect("hf_aprs history mutex poisoned");
|
.expect("hf_aprs history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -471,7 +491,8 @@ pub fn clear_hf_aprs_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_ais_history(context: &FrontendRuntimeContext) {
|
pub fn clear_ais_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ais
|
.decode_history
|
||||||
|
.ais
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ais history mutex poisoned");
|
.expect("ais history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -479,7 +500,8 @@ pub fn clear_ais_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_vdes_history(context: &FrontendRuntimeContext) {
|
pub fn clear_vdes_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.vdes
|
.decode_history
|
||||||
|
.vdes
|
||||||
.lock()
|
.lock()
|
||||||
.expect("vdes history mutex poisoned");
|
.expect("vdes history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -487,7 +509,8 @@ pub fn clear_vdes_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.cw
|
.decode_history
|
||||||
|
.cw
|
||||||
.lock()
|
.lock()
|
||||||
.expect("cw history mutex poisoned");
|
.expect("cw history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -495,7 +518,8 @@ pub fn clear_cw_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_ft8_history(context: &FrontendRuntimeContext) {
|
pub fn clear_ft8_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft8
|
.decode_history
|
||||||
|
.ft8
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft8 history mutex poisoned");
|
.expect("ft8 history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -503,7 +527,8 @@ pub fn clear_ft8_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_ft4_history(context: &FrontendRuntimeContext) {
|
pub fn clear_ft4_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft4
|
.decode_history
|
||||||
|
.ft4
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft4 history mutex poisoned");
|
.expect("ft4 history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -511,7 +536,8 @@ pub fn clear_ft4_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_ft2_history(context: &FrontendRuntimeContext) {
|
pub fn clear_ft2_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.ft2
|
.decode_history
|
||||||
|
.ft2
|
||||||
.lock()
|
.lock()
|
||||||
.expect("ft2 history mutex poisoned");
|
.expect("ft2 history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
@@ -519,7 +545,8 @@ pub fn clear_ft2_history(context: &FrontendRuntimeContext) {
|
|||||||
|
|
||||||
pub fn clear_wspr_history(context: &FrontendRuntimeContext) {
|
pub fn clear_wspr_history(context: &FrontendRuntimeContext) {
|
||||||
let mut history = context
|
let mut history = context
|
||||||
.decode_history.wspr
|
.decode_history
|
||||||
|
.wspr
|
||||||
.lock()
|
.lock()
|
||||||
.expect("wspr history mutex poisoned");
|
.expect("wspr history mutex poisoned");
|
||||||
history.clear();
|
history.clear();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ use std::collections::HashMap;
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::RwLock;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
use actix_web::{delete, get, put, web, HttpResponse, Responder};
|
use actix_web::{delete, get, put, web, HttpResponse, Responder};
|
||||||
use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod};
|
use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod};
|
||||||
@@ -183,7 +183,10 @@ impl BackgroundDecodeManager {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn put_config(&self, mut config: BackgroundDecodeConfig) -> Option<BackgroundDecodeConfig> {
|
pub async fn put_config(
|
||||||
|
&self,
|
||||||
|
mut config: BackgroundDecodeConfig,
|
||||||
|
) -> Option<BackgroundDecodeConfig> {
|
||||||
config.bookmark_ids = dedup_ids(&config.bookmark_ids);
|
config.bookmark_ids = dedup_ids(&config.bookmark_ids);
|
||||||
if self.store.upsert(&config).await {
|
if self.store.upsert(&config).await {
|
||||||
self.trigger();
|
self.trigger();
|
||||||
|
|||||||
@@ -468,11 +468,14 @@ fn find_passes_for_sat(
|
|||||||
start_ms: i64,
|
start_ms: i64,
|
||||||
window_ms: i64,
|
window_ms: i64,
|
||||||
) -> Vec<PassPrediction> {
|
) -> Vec<PassPrediction> {
|
||||||
let elements =
|
let elements = match Elements::from_tle(
|
||||||
match Elements::from_tle(Some(entry.name.clone()), entry.line1.as_bytes(), entry.line2.as_bytes()) {
|
Some(entry.name.clone()),
|
||||||
Ok(e) => e,
|
entry.line1.as_bytes(),
|
||||||
Err(_) => return vec![],
|
entry.line2.as_bytes(),
|
||||||
};
|
) {
|
||||||
|
Ok(e) => e,
|
||||||
|
Err(_) => return vec![],
|
||||||
|
};
|
||||||
let constants = match Constants::from_elements(&elements) {
|
let constants = match Constants::from_elements(&elements) {
|
||||||
Ok(c) => c,
|
Ok(c) => c,
|
||||||
Err(_) => return vec![],
|
Err(_) => return vec![],
|
||||||
|
|||||||
@@ -15,15 +15,12 @@ use crate::rig::response::RigError;
|
|||||||
fn apply_jitter(delay: Duration) -> Duration {
|
fn apply_jitter(delay: Duration) -> Duration {
|
||||||
// Simple deterministic-ish jitter using the current instant's low bits.
|
// Simple deterministic-ish jitter using the current instant's low bits.
|
||||||
// We avoid pulling in `rand` for this single use.
|
// We avoid pulling in `rand` for this single use.
|
||||||
let nanos = std::time::Instant::now()
|
let nanos = std::time::Instant::now().elapsed().as_nanos().wrapping_add(
|
||||||
.elapsed()
|
std::time::SystemTime::now()
|
||||||
.as_nanos()
|
.duration_since(std::time::UNIX_EPOCH)
|
||||||
.wrapping_add(
|
.unwrap_or_default()
|
||||||
std::time::SystemTime::now()
|
.as_nanos(),
|
||||||
.duration_since(std::time::UNIX_EPOCH)
|
);
|
||||||
.unwrap_or_default()
|
|
||||||
.as_nanos(),
|
|
||||||
);
|
|
||||||
// Map to range [0.75, 1.25]
|
// Map to range [0.75, 1.25]
|
||||||
let frac = (nanos % 1000) as f64 / 1000.0; // 0.0 .. 1.0
|
let frac = (nanos % 1000) as f64 / 1000.0; // 0.0 .. 1.0
|
||||||
let factor = 0.75 + frac * 0.5; // 0.75 .. 1.25
|
let factor = 0.75 + frac * 0.5; // 0.75 .. 1.25
|
||||||
|
|||||||
+30
-16
@@ -383,7 +383,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_aprs(&mut h);
|
Self::prune_aprs(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, pkt): &(Instant, AprsPacket)| pkt.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, pkt): &(Instant, AprsPacket)| pkt.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_aprs_history(&self) {
|
pub fn clear_aprs_history(&self) {
|
||||||
@@ -426,7 +428,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_hf_aprs(&mut h);
|
Self::prune_hf_aprs(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, pkt): &(Instant, AprsPacket)| pkt.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, pkt): &(Instant, AprsPacket)| pkt.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_hf_aprs_history(&self) {
|
pub fn clear_hf_aprs_history(&self) {
|
||||||
@@ -463,7 +467,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_cw(&mut h);
|
Self::prune_cw(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, evt): &(Instant, CwEvent)| evt.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, evt): &(Instant, CwEvent)| evt.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_cw_history(&self) {
|
pub fn clear_cw_history(&self) {
|
||||||
@@ -500,7 +506,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_ft8(&mut h);
|
Self::prune_ft8(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, msg): &(Instant, Ft8Message)| msg.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, msg): &(Instant, Ft8Message)| msg.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_ft8_history(&self) {
|
pub fn clear_ft8_history(&self) {
|
||||||
@@ -537,7 +545,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_ft4(&mut h);
|
Self::prune_ft4(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, msg): &(Instant, Ft8Message)| msg.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, msg): &(Instant, Ft8Message)| msg.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_ft4_history(&self) {
|
pub fn clear_ft4_history(&self) {
|
||||||
@@ -574,7 +584,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_ft2(&mut h);
|
Self::prune_ft2(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, msg): &(Instant, Ft8Message)| msg.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, msg): &(Instant, Ft8Message)| msg.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_ft2_history(&self) {
|
pub fn clear_ft2_history(&self) {
|
||||||
@@ -611,7 +623,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_wspr(&mut h);
|
Self::prune_wspr(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, msg): &(Instant, WsprMessage)| msg.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, msg): &(Instant, WsprMessage)| msg.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_wspr_history(&self) {
|
pub fn clear_wspr_history(&self) {
|
||||||
@@ -651,7 +665,9 @@ impl DecoderHistories {
|
|||||||
let before = h.len();
|
let before = h.len();
|
||||||
Self::prune_lrpt(&mut h);
|
Self::prune_lrpt(&mut h);
|
||||||
self.adjust_total_count(before, h.len());
|
self.adjust_total_count(before, h.len());
|
||||||
h.iter().map(|(_, img): &(Instant, LrptImage)| img.clone()).collect()
|
h.iter()
|
||||||
|
.map(|(_, img): &(Instant, LrptImage)| img.clone())
|
||||||
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_lrpt_history(&self) {
|
pub fn clear_lrpt_history(&self) {
|
||||||
@@ -735,15 +751,13 @@ fn find_device(
|
|||||||
host.output_devices()
|
host.output_devices()
|
||||||
};
|
};
|
||||||
match devices_result {
|
match devices_result {
|
||||||
Ok(mut devs) => {
|
Ok(mut devs) => match devs.find(|d| d.name().map(|n| n == *name).unwrap_or(false)) {
|
||||||
match devs.find(|d| d.name().map(|n| n == *name).unwrap_or(false)) {
|
Some(d) => Some(d),
|
||||||
Some(d) => Some(d),
|
None => {
|
||||||
None => {
|
warn!("Audio {}: device '{}' not found, retrying", direction, name);
|
||||||
warn!("Audio {}: device '{}' not found, retrying", direction, name);
|
None
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!(
|
warn!(
|
||||||
"Audio {}: failed to enumerate devices, retrying: {}",
|
"Audio {}: failed to enumerate devices, retrying: {}",
|
||||||
|
|||||||
@@ -382,18 +382,15 @@ async fn handle_client(
|
|||||||
// SGP4 propagation when multiple clients request passes concurrently.
|
// SGP4 propagation when multiple clients request passes concurrently.
|
||||||
if matches!(envelope.cmd, ClientCommand::GetSatPasses) {
|
if matches!(envelope.cmd, ClientCommand::GetSatPasses) {
|
||||||
// Check cache first.
|
// Check cache first.
|
||||||
let cached = sat_pass_cache
|
let cached = sat_pass_cache.lock().ok().and_then(|guard| {
|
||||||
.lock()
|
guard.as_ref().and_then(|c| {
|
||||||
.ok()
|
if c.computed_at.elapsed() < SAT_PASS_CACHE_TTL {
|
||||||
.and_then(|guard| {
|
Some(c.result.clone())
|
||||||
guard.as_ref().and_then(|c| {
|
} else {
|
||||||
if c.computed_at.elapsed() < SAT_PASS_CACHE_TTL {
|
None
|
||||||
Some(c.result.clone())
|
}
|
||||||
} else {
|
})
|
||||||
None
|
});
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
let result = if let Some(cached_result) = cached {
|
let result = if let Some(cached_result) = cached {
|
||||||
cached_result
|
cached_result
|
||||||
@@ -693,7 +690,15 @@ mod tests {
|
|||||||
|
|
||||||
let mut auth = HashSet::new();
|
let mut auth = HashSet::new();
|
||||||
auth.insert("secret".to_string());
|
auth.insert("secret".to_string());
|
||||||
let handle = tokio::spawn(run_listener(addr, rigs, default_id, auth, None, ListenerTimeouts::default(), shutdown_rx));
|
let handle = tokio::spawn(run_listener(
|
||||||
|
addr,
|
||||||
|
rigs,
|
||||||
|
default_id,
|
||||||
|
auth,
|
||||||
|
None,
|
||||||
|
ListenerTimeouts::default(),
|
||||||
|
shutdown_rx,
|
||||||
|
));
|
||||||
|
|
||||||
let stream = TcpStream::connect(addr).await.expect("connect");
|
let stream = TcpStream::connect(addr).await.expect("connect");
|
||||||
let (reader, mut writer) = stream.into_split();
|
let (reader, mut writer) = stream.into_split();
|
||||||
|
|||||||
@@ -486,7 +486,6 @@ impl Ft817 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Rig for Ft817 {
|
impl Rig for Ft817 {
|
||||||
|
|||||||
Reference in New Issue
Block a user