diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0e9ac4ae..5554a318 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,8 +1,6 @@ # This file is autogenerated by maturin v1.3.1 # To update, run -# # maturin generate-ci github -# name: CI on: diff --git a/.github/workflows/test-installation.yml b/.github/workflows/Install.yml similarity index 85% rename from .github/workflows/test-installation.yml rename to .github/workflows/Install.yml index 893c5abf..3ab292fe 100644 --- a/.github/workflows/test-installation.yml +++ b/.github/workflows/Install.yml @@ -4,13 +4,18 @@ on: push: branches: - main + - master + - master-jk-working + tags: + - '*' pull_request: branches: - main + workflow_dispatch: jobs: build-and-test: - runs-on: Ubuntu + runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -41,4 +46,4 @@ jobs: - name: Verify Installation run: | source ./AISdb/bin/activate - python -c "import aisdb; assert aisdb.__version__ >= '1.7.0', f'Unexpected aisdb version: {aisdb.__version__}'" + python -c "import aisdb; assert aisdb.__version__ >= '1.7.1', f'Unexpected aisdb version: {aisdb.__version__}'" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3092ce13..9475346b 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,5 @@ target /testdata/ testinput !aisdb/tests/testdata/ +build.sh +install-rust.sh \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index b7285786..87a90845 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -59,8 +59,7 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -gabriel@spadon.com.br. +reported to the community leaders responsible for enforcement at aisviz@dal.ca. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/Cargo.lock b/Cargo.lock index 25ed2b99..af9eb61a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,7 +52,7 @@ dependencies = [ [[package]] name = "aisdb" -version = "1.7.0" +version = "1.7.1" dependencies = [ "aisdb-lib", "aisdb-receiver", @@ -69,7 +69,7 @@ dependencies = [ [[package]] name = "aisdb-lib" -version = "1.7.0" +version = "1.7.1" dependencies = [ "chrono", "csv", @@ -1082,7 +1082,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 0.2.9", + "http", "indexmap", "slab", "tokio", @@ -1205,17 +1205,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http-body" version = "0.4.5" @@ -1223,7 +1212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http 0.2.9", + "http", "pin-project-lite", ] @@ -1266,7 +1255,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.9", + "http", "http-body", "httparse", "httpdate", @@ -2158,7 +2147,7 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http 0.2.9", + "http", "http-body", "hyper", "hyper-tls", @@ -2287,32 +2276,23 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring 0.17.8", - "rustls-pki-types", "rustls-webpki", - "subtle", - "zeroize", + "sct", ] -[[package]] -name = "rustls-pki-types" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048a63e5b3ac996d78d402940b5fa47973d2d080c6c6fffa1d0f19c4445310b7" - [[package]] name = "rustls-webpki" -version = "0.102.2" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring 0.17.8", - "rustls-pki-types", "untrusted 0.9.0", ] @@ -2930,24 +2910,23 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.21.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" dependencies = [ "byteorder", "bytes", "data-encoding", - "http 1.0.0", + "http", "httparse", "log", "rand", - "rustls 0.22.2", - "rustls-pki-types", + "rustls 0.21.10", "sha1", "thiserror", "url", "utf-8", - "webpki-roots 0.26.1", + "webpki-roots 0.24.0", ] [[package]] @@ -3253,11 +3232,11 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" dependencies = [ - "rustls-pki-types", + "rustls-webpki", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 67d4ced8..81182189 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] -version = "1.7.0" name = "aisdb" edition = "2021" +version = "1.7.1" include = [ "aisdb/*.py", "aisdb/aisdb_sql", "aisdb/database/*.py", "aisdb/webdata/*.py", "/src", "pyproject.toml", "aisdb_web/dist_map/index.html", "aisdb_web/dist_map/favicon.svg", "aisdb_web/dist_map/favicon.png", "aisdb_web/dist_map/assets/*", "aisdb_web/dist_map_bingmaps/index.html", "aisdb_web/dist_map_bingmaps/favicon.svg", "aisdb_web/dist_map_bingmaps/favicon.png", "aisdb_web/dist_map_bingmaps/assets/*",] [lib] diff --git a/SECURITY.md b/SECURITY.md index e003538a..d8cbbe6a 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,7 +15,7 @@ The AISdb team takes security vulnerabilities seriously. If you discover a secur ### How to Report a Security Vulnerability: -- **Email:** Send an email to Gabriel Spadon at gabriel@spadon.com.br. Please include a detailed description of the issue, including the steps to reproduce the vulnerability. If possible, include patches, scripts, or other resources that could help evaluate the vulnerability. +- **Email:** Send an email to aisviz@dal.ca. Please include a detailed description of the issue, including the steps to reproduce the vulnerability. If possible, include patches, scripts, or other resources that could help evaluate the vulnerability. - **GitHub Issue:** For vulnerabilities that do not immediately impact the security of the project or its users (such as potential optimizations or best practices), consider opening a GitHub issue on our repository. ### Response Expectations: diff --git a/aisdb/proc_util.py b/aisdb/proc_util.py index 76aa2d36..d7500770 100644 --- a/aisdb/proc_util.py +++ b/aisdb/proc_util.py @@ -62,9 +62,7 @@ def _segment_rng(track, maxdelta, key='time') -> filter: yield rng -def write_csv_rows(rows, - pathname='/data/smith6/ais/scripts/output.csv', - mode='a'): +def write_csv_rows(rows, pathname='output.csv', mode='a'): with open(pathname, mode) as f: f.write('\n'.join( map( diff --git a/aisdb_lib/Cargo.lock b/aisdb_lib/Cargo.lock index 5460d147..c17496d4 100644 --- a/aisdb_lib/Cargo.lock +++ b/aisdb_lib/Cargo.lock @@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "aisdb-lib" -version = "1.7.0" +version = "1.7.1" dependencies = [ "chrono", "csv", diff --git a/aisdb_lib/Cargo.toml b/aisdb_lib/Cargo.toml index 3947f6ce..1fbf4be4 100644 --- a/aisdb_lib/Cargo.toml +++ b/aisdb_lib/Cargo.toml @@ -1,16 +1,17 @@ [package] -version = "1.7.0" +version = "1.7.1" name = "aisdb-lib" -authors = [ "MERIDIAN // Matt Smith matthew.smith@dal.ca",] +authors = [ "[AISViz] Making vessels tracking data available to everyone // aisviz@dal.ca",] edition = "2021" include = [ "../aisdb/aisdb_sql", "/src/*",] build = "build.rs" readme = "../readme.rst" description = "AIS Database and Processing Utils" -homepage = "https://aisdb.meridian.cs.dal.ca/" -documentation = "https://aisdb.meridian.cs.dal.ca/doc/readme.html" -repository = "https://git-dev.cs.dal.ca/meridian/aisdb" -license-file = "../license.txt" +homepage = "https://aisviz.github.io/" +repository = "https://github.com/AISViz/AISdb" +tutorials = "https://aisviz.gitbook.io/tutorials/" +documentation = "https://aisviz.gitbook.io/documentation/" +license-file = "../LICENSE" [features] default = [ "sqlite", "postgres",] diff --git a/aisdb_lib/src/csvreader.rs b/aisdb_lib/src/csvreader.rs index 8ab478ac..d9d1514b 100644 --- a/aisdb_lib/src/csvreader.rs +++ b/aisdb_lib/src/csvreader.rs @@ -1,8 +1,8 @@ pub use std::{ fs::{create_dir_all, read_dir, File}, io::{BufRead, BufReader, Error, Write}, + path::Path, time::{Duration, Instant}, - path::{Path}, }; use chrono::{NaiveDateTime, TimeZone, Utc}; @@ -170,12 +170,12 @@ pub fn sqlite_decodemsgs_ee_csv( let f3 = filename.to_str().unwrap(); let f4 = Path::new(f3); let fname = f4.file_name().unwrap().to_str().unwrap(); -// let fname = filename -// .to_str() -// .unwrap() -// .rsplit_once(std::path::MAIN_SEPARATOR) -// .unwrap() -// .1; + // let fname = filename + // .to_str() + // .unwrap() + // .rsplit_once(std::path::MAIN_SEPARATOR) + // .unwrap() + // .1; let fname1 = format!("{:<1$}", fname, 64); let elapsed1 = format!( "elapsed: {:>1$}s", @@ -309,12 +309,12 @@ pub fn postgres_decodemsgs_ee_csv( let f3 = filename.to_str().unwrap(); let f4 = Path::new(f3); let fname = f4.file_name().unwrap().to_str().unwrap(); -// let fname = filename -// .to_str() -// .unwrap() -// .rsplit_once(std::path::MAIN_SEPARATOR) -// .unwrap() -// .1; + // let fname = filename + // .to_str() + // .unwrap() + // .rsplit_once(std::path::MAIN_SEPARATOR) + // .unwrap() + // .1; let fname1 = format!("{:<1$}", fname, 64); let elapsed1 = format!( "elapsed: {:>1$}s", diff --git a/aisdb_lib/src/decode.rs b/aisdb_lib/src/decode.rs index 6a94bc02..222bea8d 100644 --- a/aisdb_lib/src/decode.rs +++ b/aisdb_lib/src/decode.rs @@ -2,8 +2,8 @@ pub use std::{ ffi::OsStr, fs::{create_dir_all, metadata, read_dir, File}, io::{BufRead, BufReader, Error, Write}, + path::Path, time::{Duration, Instant}, - path::{Path}, }; use nmea_parser::{ @@ -76,19 +76,19 @@ pub fn parse_headers(line: Result) -> Option<(String, i32)> { { return Some((payload.to_string(), i.try_into().unwrap())); } else { -// #[cfg(debug_assertions)] -// println!( -// "skipped- tag:{:?}\tmeta:{:?}\tpayload:{:?}", -// tag, meta, payload -// ); + // #[cfg(debug_assertions)] + // println!( + // "skipped- tag:{:?}\tmeta:{:?}\tpayload:{:?}", + // tag, meta, payload + // ); return None; } } } } if meta.contains(' ') { -// #[cfg(debug_assertions)] -// println!("{:?}", meta); + // #[cfg(debug_assertions)] + // println!("{:?}", meta); let ii = meta.split_once(' ').unwrap().0.parse::().unwrap_or(0); if ii == 0 { return None; @@ -101,16 +101,16 @@ pub fn parse_headers(line: Result) -> Option<(String, i32)> { if 946731600 < ii && ii <= now { Some((payload.to_string(), ii.try_into().unwrap())) } else { -// #[cfg(debug_assertions)] -// println!( -// "skipped- ii:{:?}\tmeta:{:?}\tpayload:{:?}", -// ii, meta, payload -// ); + // #[cfg(debug_assertions)] + // println!( + // "skipped- ii:{:?}\tmeta:{:?}\tpayload:{:?}", + // ii, meta, payload + // ); None } } else { -// #[cfg(debug_assertions)] -// println!("skipped- meta:{:?}\tpayload:{:?}", meta, payload); + // #[cfg(debug_assertions)] + // println!("skipped- meta:{:?}\tpayload:{:?}", meta, payload); None } } @@ -124,11 +124,11 @@ pub fn skipmsg(msg: &str, epoch: &i32) -> Option<(String, i32)> { if cols.len() < 6 { return Some((msg.to_string(), *epoch)); } -// #[cfg(debug_assertions)] -// println!( -// "{:?} {:?} {:?} {:?} {:?} {:?}", -// cols[0], cols[1], cols[2], cols[3], cols[4], cols[5] -// ); + // #[cfg(debug_assertions)] + // println!( + // "{:?} {:?} {:?} {:?} {:?} {:?}", + // cols[0], cols[1], cols[2], cols[3], cols[4], cols[5] + // ); let count = str::parse::(cols[1]).unwrap_or(1); let fragment_no = str::parse::(cols[2]).unwrap_or(1); match (cols[0], count, fragment_no, cols[3], cols[4], cols[5]) { @@ -151,8 +151,8 @@ pub fn filter_vesseldata( epoch: &i32, parser: &mut NmeaParser, ) -> Option<(ParsedMessage, i32, bool)> { -// #[cfg(debug_assertions)] -// println!("{:?} {:?}", epoch, sentence); + // #[cfg(debug_assertions)] + // println!("{:?} {:?}", epoch, sentence); match parser.parse_sentence(sentence).ok()? { ParsedMessage::VesselDynamicData(vdd) => { @@ -197,12 +197,12 @@ fn print_status_info( let f3 = filename.to_str().unwrap(); let f4 = Path::new(f3); let fname = f4.file_name().unwrap().to_str().unwrap(); -// let fname = filename -// .to_str() -// .unwrap() -// .rsplit_once(std::path::MAIN_SEPARATOR) -// .unwrap() -// .1; + // let fname = filename + // .to_str() + // .unwrap() + // .rsplit_once(std::path::MAIN_SEPARATOR) + // .unwrap() + // .1; let fname1 = format!("{:<1$}", fname, 64); let elapsed1 = format!( "elapsed: {:>1$}s", diff --git a/build.rs b/build.rs index 52a080e5..8fd31644 100644 --- a/build.rs +++ b/build.rs @@ -26,27 +26,43 @@ fn remove_source_code_folder() { fn download_source(version: &str, download_type: &DownloadType) -> Result { let (url, type_of_download, file_name) = match download_type { - DownloadType::SourceCode => ("https://github.com/AISViz/aisdb-web/archive/refs/heads/main.zip".to_string(), - "Source Code", "main.zip"), - DownloadType::Build => (format!("https://github.com/AISViz/AISdb-Web/releases/{}/download/aisdb_web.zip", version), - "Build Project", "aisdb_web.zip"), + DownloadType::SourceCode => ( + "https://github.com/AISViz/aisdb-web/archive/refs/heads/main.zip".to_string(), + "Source Code", + "main.zip", + ), + DownloadType::Build => ( + format!( + "https://github.com/AISViz/AISdb-Web/releases/{}/download/aisdb_web.zip", + version + ), + "Build Project", + "aisdb_web.zip", + ), }; let zipfile_bytes = get(url) .expect(format!("downloading {}", type_of_download).as_str()) .bytes() .expect("get asset bytes"); - + //assert!(zipfile_bytes.len() > 64); // make sure we didnt get error 404 if zipfile_bytes.len() <= 64 { - eprintln!("Download: {}, result: {:#?}", type_of_download, zipfile_bytes); + eprintln!( + "Download: {}, result: {:#?}", + type_of_download, zipfile_bytes + ); let (what_to_download, extracted_folder, url) = match download_type { - DownloadType::SourceCode => { - ("source code", "AISdb-Web-main", "https://github.com/AISViz/AISdb-Web/") - }, - DownloadType::Build => { - ("source code", "aisdb_web", "https://github.com/AISViz/AISdb-Web/releases/") - } + DownloadType::SourceCode => ( + "source code", + "AISdb-Web-main", + "https://github.com/AISViz/AISdb-Web/", + ), + DownloadType::Build => ( + "source code", + "aisdb_web", + "https://github.com/AISViz/AISdb-Web/releases/", + ), }; eprintln!("Please manually download the {} from the following link, and put the extracted folder {} in the root of the project:\n{}", what_to_download, extracted_folder, url); return Err("assert!(zipfile_bytes.len() > 64)".to_string()); // make sure we didnt get error 404s @@ -73,7 +89,7 @@ fn main() -> Result<(), Box> { // #[cfg(not(debug_assertions))] // download web assets from gitlab CD artifacts // if OFFLINE_BUILD is not set, it is expected that artifacts will be passed from previous job - + let (download_type, file_name, build_type) = match std::env::var("OFFLINE_BUILD") { Ok(_) => (DownloadType::SourceCode, "main.zip", "OFFLINE_BUILD"), Err(_) => (DownloadType::Build, "aisdb_web.zip", "ONLINE_BUILD"), @@ -81,7 +97,9 @@ fn main() -> Result<(), Box> { let version = "latest"; - if (build_type == "OFFLINE_BUILD" && !check_source_code_folder()) || build_type == "ONLINE_BUILD"{ + if (build_type == "OFFLINE_BUILD" && !check_source_code_folder()) + || build_type == "ONLINE_BUILD" + { let zipfilepath = download_source(&version, &download_type)?; // unzip web assets into project let unzip = Command::new("unzip") @@ -96,7 +114,6 @@ fn main() -> Result<(), Box> { remove_file(file_name).expect("deleting zip"); } - // web assets may also be built locally if OFFLINE_BUILD is set if build_type == "OFFLINE_BUILD" { // build wasm @@ -163,7 +180,11 @@ fn main() -> Result<(), Box> { .env("VITE_AISDBPORT", "9924") .env("VITE_BINGMAPTILES", "1") .env("VITE_TILESERVER", "aisdb.meridian.cs.dal.ca") - .args(["vite", "build", "--outDir=../../aisdb_web/dist_map_bingmaps"]) + .args([ + "vite", + "build", + "--outDir=../../aisdb_web/dist_map_bingmaps", + ]) .output() .unwrap(); eprintln!("{}", String::from_utf8_lossy(&vite_build_2.stderr[..])); @@ -188,4 +209,4 @@ fn main() -> Result<(), Box> { .expect("running wasm-opt"); Ok(()) -} \ No newline at end of file +} diff --git a/pyproject.toml b/pyproject.toml index 7ce07906..bdf82957 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,26 +8,23 @@ requires-python = ">=3.8" requires-dist = [ "maturin>=1.0", "numpy", "wheel",] dependencies = [ "MarkupSafe", "flask", "packaging", "pillow", "requests", "selenium", "shapely", "toml", "tqdm", "numpy", "webdriver-manager", "psycopg", "psycopg[binary]", "python-dateutil", "orjson", "websockets","beautifulsoup4", "pyproj"] zip-safe = false -version = "1.7.0" +version = "1.7.1" readme = "readme.rst" -description = "AIS Database and Processing Utils" -classifiers = [ "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Rust", "Programming Language :: SQL", "Programming Language :: JavaScript", "Topic :: Communications :: Ham Radio", "Topic :: Database :: Database Engines/Servers", "Topic :: Database :: Front-Ends", "Topic :: Scientific/Engineering :: GIS", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Utilities",] +description = "Smart AIS data storage and integration" +classifiers = [ "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: AGPL-3.0 License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Rust", "Programming Language :: SQL", "Programming Language :: JavaScript", "Topic :: Communications :: Ham Radio", "Topic :: Database :: Database Engines/Servers", "Topic :: Database :: Front-Ends", "Topic :: Scientific/Engineering :: GIS", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Utilities",] [[project.authors]] -name = "Matthew Smith" -email = "matthew.smith@dal.ca" - -[[project.authors]] -name = "Jinkun Chen" -email = "jinkun.chen@dal.ca" +name = "[AISViz] Making vessels tracking data available to everyone" +email = "aisviz@dal.ca" [project.license-files] -paths = [ "license.txt",] +paths = [ "LICENSE",] [project.urls] -homepage = "https://aisdb.meridian.cs.dal.ca/" -documentation = "https://aisdb.meridian.cs.dal.ca/doc/readme.html" -repository = "https://git-dev.cs.dal.ca/meridian/aisdb" +homepage = "https://aisviz.github.io/" +repository = "https://github.com/AISViz/AISdb" +tutorials = "https://aisviz.gitbook.io/tutorials/" +documentation = "https://aisviz.gitbook.io/documentation/" [project.optional-dependencies] test = [ "coverage", "pytest", "pytest-cov", "pytest-dotenv",] diff --git a/receiver/Cargo.toml b/receiver/Cargo.toml index 74a4aac5..fe75afee 100644 --- a/receiver/Cargo.toml +++ b/receiver/Cargo.toml @@ -2,12 +2,14 @@ name = "aisdb-receiver" version = "0.0.1" edition = "2021" -authors = [ "MERIDIAN // Matt Smith matthew.smith@dal.ca",] +authors = [ "[AISViz] Making vessels tracking data available to everyone // aisviz@dal.ca",] readme = "../readme.rst" description = "AISDB Receiver" -homepage = "https://aisdb.meridian.cs.dal.ca/" -documentation = "https://aisdb.meridian.cs.dal.ca/doc/readme.html" -license-file = "../license.txt" +homepage = "https://aisviz.github.io/" +repository = "https://github.com/AISViz/AISdb" +tutorials = "https://aisviz.gitbook.io/tutorials/" +documentation = "https://aisviz.gitbook.io/documentation/" +license-file = "../LICENSE" [lib] @@ -15,7 +17,6 @@ license-file = "../license.txt" name = "aisdb-receiver" path = "src/receiver.rs" - [dependencies] aisdb-lib = { path = "../aisdb_lib" } mproxy-client = { version = "0.1" } diff --git a/receiver/src/receiver.rs b/receiver/src/receiver.rs index 616301d4..aa563849 100644 --- a/receiver/src/receiver.rs +++ b/receiver/src/receiver.rs @@ -427,7 +427,7 @@ fn handle_websocket_client( Ok((count_input, remote_addr)) => { //#[cfg(debug_assertions)] //println!("RX: {}", String::from_utf8_lossy(&buf[0..count_input])); - if let Err(e) = websocket.write_message(Message::Text( + if let Err(e) = websocket.send(Message::Text( String::from_utf8(buf[0..count_input].to_vec()).unwrap(), )) { eprintln!("dropping client: {} {}", remote_addr, e); diff --git a/src/lib.rs b/src/lib.rs index 1ddeb01e..4467c1c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ //! Rust exports for python API -use std::cmp::{max, min}; +use std::cmp::max; use std::fs::metadata; use std::path::PathBuf; use std::sync::mpsc::channel; @@ -95,7 +95,7 @@ pub fn decoder( let mut sys = System::new_with_specifics(RefreshKind::new().with_memory()); sys.refresh_memory(); - let mut worker_count = 0; + let worker_count; if workers > 0 { worker_count = workers; @@ -195,7 +195,7 @@ pub fn decoder( verbose, ) .expect("decoding NM4"); - update_done_files(&mut completed, &mut errored, Ok(f.clone() ) ); + update_done_files(&mut completed, &mut errored, Ok(f.clone())); } if !psql_conn_string.is_empty() { let sender = sender.clone(); @@ -226,7 +226,7 @@ pub fn decoder( if dbpath != PathBuf::from("") { sqlite_decodemsgs_ee_csv(d.to_path_buf(), f.clone(), &source, verbose) .expect("decoding CSV"); - update_done_files(&mut completed, &mut errored, Ok(f.clone() ) ); + update_done_files(&mut completed, &mut errored, Ok(f.clone())); } if !psql_conn_string.is_empty() { let sender = sender.clone();