[Upd] mtp update

This commit is contained in:
Alex Emmet 2026-07-20 15:28:13 +02:00
commit 70015c4d69
9 changed files with 475 additions and 842 deletions

1005
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -5,20 +5,21 @@ edition = "2024"
[dependencies]
mtp = { git = "https://git.methanium.net/methanium/mtp", features = [
"host",
"crypto",
"files",
"web-server",
] }
actix-web = { version = "4.12.1", features = ["rustls-0_23"] }
aes-gcm = "*"
ansi_term = "0.12.1"
anyhow = "1.0.101"
base64 = "0.22.1"
bytes = "1"
dashmap = "6.1.0"
dotenv = "0.15.0"
hex = "0.4.3"
hkdf = "0.12.4"
http = "1"
json = "0.12.4"
once_cell = "1.21.3"
rand = "0.8"
@ -30,7 +31,6 @@ rustls = { version = "0.23.37", default-features = false, features = [
"aws-lc-rs",
"prefer-post-quantum",
] }
rustls-pemfile = "2.2.0"
sha2 = "0.10.9"
sqlx = { version = "0.8.6", features = ["mysql", "runtime-async-std"] }
strum = "0.27.2"
@ -40,6 +40,3 @@ uuid = { version = "1.19.0", features = ["v4"] }
x448 = "0.6.0"
zip = "6.0.0"
thiserror = "2.0.18"
mtp-crypto = { git = "https://git.methanium.net/methanium/mtp", version = "0.1.0", features = [
"pqc",
] }

View file

@ -10,8 +10,8 @@ use crate::util::file_util::get_directory;
use crate::util::logger::PrintType;
use crate::util::logger::startup;
use dotenv::from_path;
use mtp::files::{load_keyring as load_keyring_file, save_keyring, save_public_key_bundle};
use mtp_crypto::Keyring;
use mtp::files::{load_keyring_raw, save_keyring_raw, save_public_key_bundle};
use mtp::crypto::Keyring;
use once_cell::sync::Lazy;
use rustls::crypto::aws_lc_rs::default_provider;
use std::env;
@ -20,9 +20,9 @@ use std::path::Path;
const KEYRING_PATH: &str = "./omega.mk";
static KEYRING: Lazy<Keyring> = Lazy::new(|| {
load_keyring_file(KEYRING_PATH).unwrap_or_else(|_| {
load_keyring_raw(KEYRING_PATH).unwrap_or_else(|_| {
let kr = Keyring::generate();
save_keyring(&kr, KEYRING_PATH).expect("Failed to save generated keyring");
save_keyring_raw(&kr, KEYRING_PATH).expect("Failed to save generated keyring");
save_public_key_bundle(&kr.public_key_bundle(), KEYRING_PATH)
.expect("Failed to save generated public key bundle");
eprintln!("Generated new keyring at {}", KEYRING_PATH);
@ -48,18 +48,6 @@ async fn main() {
log_in!("Incoming messages");
log_out!("Outgoing messages");
let omikron_port: u16 = env::var("OMIKRON_PORT")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(9187);
let omikron_handle = tokio::spawn(async move {
match omikron_connection::start(omikron_port).await {
Err(e) => log_err!(0, PrintType::General, "{:?}", e),
_ => {}
}
});
log!("Started");
log!(" .env");
if let Err(e) = initialize_db().await {
@ -77,13 +65,13 @@ async fn main() {
log!(" Users");
}
let api_port: u16 = env::var("API_PORT")
let port: u16 = env::var("PORT")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(9188);
.unwrap_or(443);
tokio::select! {
result = server::server::start(api_port) => {
result = omikron_connection::start(port) => {
if let Err(e) = result {
log_err!(0, PrintType::General, "Server error: {:?}", e);
}
@ -92,6 +80,4 @@ async fn main() {
log!("Shutting down on signal...");
}
}
omikron_handle.abort();
}

View file

@ -4,24 +4,31 @@ use crate::sql::sql::{get_by_user_id, get_iota_by_id, get_omikron_by_id};
use crate::sql::user_online_tracker::{get_all_connections, get_iota_primary_omikron_connection};
use crate::transport::omikron_manager::get_random_omikron;
use crate::util::file_util::get_directory;
use actix_web::HttpResponse;
use actix_web::http::{StatusCode, header};
use base64::Engine as _;
use bytes::Bytes;
use http::{Method, StatusCode};
use json::JsonValue;
use mtp::webserver::{Http3Request, Http3Response, RouteParams};
pub async fn handle(path: &str, body_string: Option<String>) -> HttpResponse {
if path == "OPTIONS" {
return HttpResponse::Ok()
.insert_header(("Access-Control-Allow-Origin", "*"))
.insert_header(("Access-Control-Allow-Methods", "GET, POST, OPTIONS"))
.insert_header(("Access-Control-Allow-Headers", "*"))
.finish();
pub async fn handle(request: Http3Request, response: Http3Response) -> Http3Response {
let method = request.method;
let path = request.uri.path().to_string();
let body_string = request
.body
.map(|body| String::from_utf8_lossy(&body).to_string());
if method == Method::OPTIONS {
return response
.status(StatusCode::OK)
.header("access-control-allow-origin", "*")
.header("access-control-allow-methods", "GET, POST, OPTIONS")
.header("access-control-allow-headers", "*");
}
let path_parts: Vec<&str> = path.split("/").filter(|s| !s.is_empty()).collect();
let path_parts: Vec<&str> = path.split('/').filter(|s| !s.is_empty()).collect();
let _body: Option<JsonValue> = if body_string.is_some() {
if let Ok(body_json) = json::parse(&body_string.unwrap()) {
let _body: Option<JsonValue> = if let Some(ref bs) = body_string {
if let Ok(body_json) = json::parse(bs) {
Some(body_json)
} else {
None
@ -39,20 +46,22 @@ pub async fn handle(path: &str, body_string: Option<String>) -> HttpResponse {
match std::fs::read(file_path) {
Ok(file_bytes) => {
return HttpResponse::Ok()
.insert_header(("Access-Control-Allow-Origin", "*"))
.insert_header(("Content-Type", "application/zip"))
.insert_header((
"Content-Disposition",
return response
.status(StatusCode::OK)
.header("access-control-allow-origin", "*")
.header("content-type", "application/zip")
.header(
"content-disposition",
"attachment; filename=\"iota_frontend.zip\"",
))
.body(file_bytes);
)
.body(Bytes::from(file_bytes));
}
Err(_) => {
let mut res = JsonValue::new_object();
res["status"] = "error_not_found".into();
return HttpResponse::NotFound()
.insert_header(("Access-Control-Allow-Origin", "*"))
return response
.status(StatusCode::NOT_FOUND)
.header("access-control-allow-origin", "*")
.body(res.dump());
}
}
@ -309,6 +318,23 @@ pub async fn handle(path: &str, body_string: Option<String>) -> HttpResponse {
}
}
// ==================================================
// DIRECT - SHORT LINK RESOLUTION
// ==================================================
["direct", short @ ..] => {
let short_str = short.join("/");
let short = short_str.replace("/", "");
if let Ok(long) = crate::server::short_link::get_short_link(&short).await {
return response
.status(StatusCode::TEMPORARY_REDIRECT)
.header("location", &long);
} else {
return response
.status(StatusCode::TEMPORARY_REDIRECT)
.header("location", "https://tensamin.net");
}
}
// ==================================================
// DEFAULT
// ==================================================
@ -318,11 +344,19 @@ pub async fn handle(path: &str, body_string: Option<String>) -> HttpResponse {
(StatusCode::INTERNAL_SERVER_ERROR, res.dump())
}
};
let body_bytes = body_text.into_bytes();
HttpResponse::build(status)
.insert_header((header::ACCESS_CONTROL_ALLOW_ORIGIN, "*"))
.insert_header((header::ACCESS_CONTROL_ALLOW_HEADERS, "*"))
.insert_header((header::ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, OPTIONS"))
.body(body_bytes)
response
.status(status)
.header("access-control-allow-origin", "*")
.header("access-control-allow-headers", "*")
.header("access-control-allow-methods", "GET, POST, OPTIONS")
.body(body_text)
}
pub async fn handle_pattern(
request: Http3Request,
response: Http3Response,
_params: RouteParams,
) -> Http3Response {
handle(request, response).await
}

View file

@ -1,6 +1,7 @@
use actix_web::{HttpResponse, Responder};
use http::StatusCode;
use mtp::webserver::Http3Response;
pub async fn index_handler() -> impl Responder {
pub fn index_handler(response: Http3Response) -> Http3Response {
let documentation = r#"
Omega API Server
@ -11,7 +12,8 @@ Available Routes:
All other routes will return this documentation.
"#;
HttpResponse::Ok()
.content_type("text/plain; charset=utf-8")
response
.status(StatusCode::OK)
.header("content-type", "text/plain; charset=utf-8")
.body(documentation)
}

View file

@ -1,69 +1,19 @@
use crate::{
log,
server::{api, index::index_handler, short_link::get_short_link},
util::file_util::load_file_buf,
};
use crate::server::{api, index::index_handler};
use mtp::webserver::WebServerConfig;
use actix_web::{App, HttpRequest, HttpResponse, HttpServer, Responder, http::header, web};
use rustls::ServerConfig;
use rustls::pki_types::{CertificateDer, PrivateKeyDer};
use rustls_pemfile::{certs, pkcs8_private_keys};
pub async fn start(port: u16) -> anyhow::Result<()> {
let mut cert_reader = load_file_buf("certs", "server_cert.pem")?;
let mut key_reader = load_file_buf("certs", "server_key.pem")?;
let cert_chain: Vec<CertificateDer<'static>> =
certs(&mut cert_reader).collect::<Result<_, _>>()?;
let mut keys: Vec<PrivateKeyDer<'static>> = pkcs8_private_keys(&mut key_reader)
.map(|res| res.map(Into::into))
.collect::<Result<_, _>>()?;
let key = keys.remove(0);
let mut config = ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(cert_chain, key)?;
config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
let bind_addr = std::env::var("BIND_ADDRESS").unwrap_or_else(|_| "0.0.0.0".to_string());
let addr = format!("{}:{}", bind_addr, port);
log!(" Server on {}", addr);
HttpServer::new(move || {
App::new()
.route("/api/{path:.*}", web::to(api_handler))
.route("/direct/{path:.*}", web::to(direct_handler))
.default_service(web::to(index_handler))
})
.bind_rustls_0_23(addr, config)?
.run()
.await?;
Ok(())
}
async fn direct_handler(req: HttpRequest) -> impl Responder {
let path = req.uri().path().to_string();
let short = path.replace("/direct/", "");
if let Ok(long) = get_short_link(&short).await {
HttpResponse::TemporaryRedirect()
.append_header((header::LOCATION, long))
.finish()
} else {
HttpResponse::TemporaryRedirect()
.append_header((header::LOCATION, "https://tensamin.net"))
.finish()
}
}
async fn api_handler(req: HttpRequest, body: web::Bytes) -> HttpResponse {
let path = req.uri().path().to_string();
let body_string = String::from_utf8_lossy(&body).to_string();
api::handle(&path, Some(body_string)).await
pub fn build_web_config() -> Result<WebServerConfig, mtp::webserver::RouterError> {
WebServerConfig::new()
.route(
"/",
|_request, response| async move { index_handler(response) },
)?
.route("/api/download/iota_frontend", api::handle)?
.route("/api/get/omikron", api::handle)?
.route("/api/get/connections", api::handle)?
.route("/api/get/public_key", api::handle)?
.route_pattern("/api/get/omikron/{id}", api::handle_pattern)?
.route_pattern("/api/get/iota/{id}", api::handle_pattern)?
.route_pattern("/api/get/id/{username}", api::handle_pattern)?
.route_pattern("/api/get/user/{id}", api::handle_pattern)?
.route_pattern("/direct/{short}", api::handle_pattern)
}

View file

@ -1,5 +1,5 @@
use crate::log;
use mtp_crypto::PublicKeyBundle;
use mtp::crypto::PublicKeyBundle;
use once_cell::sync::Lazy;
use sqlx::{MySql, Pool, Row, mysql::MySqlPoolOptions};
use std::sync::atomic::{AtomicU64, Ordering};
@ -607,7 +607,10 @@ pub async fn create_new_iota(public_key: PublicKeyBundle) -> Result<i64, sqlx::E
Ok(new_id)
}
pub async fn register_complete_iota(id: i64, public_key: PublicKeyBundle) -> Result<(), sqlx::Error> {
pub async fn register_complete_iota(
id: i64,
public_key: PublicKeyBundle,
) -> Result<(), sqlx::Error> {
let pool = {
let db_lock = SQL_DB.read().await;
db_lock

View file

@ -1,6 +1,6 @@
use crate::{
load_keyring, log, log_cv_in, log_cv_out, log_err, log_in,
server::short_link::add_short_link,
server::{self, short_link::add_short_link},
sql::{
connection_status::UserStatus,
sql::{self, get_by_user_id, get_by_username, get_iota_by_id},
@ -11,12 +11,10 @@ use crate::{
};
use base64::{Engine as _, engine::general_purpose::STANDARD};
use dashmap::DashMap;
use mtp::host::{AuthenticationPolicy, Receiver, Sender};
use mtp::{
codec::{CommunicationType, CommunicationValue, DataType, DataValue},
host::{Host, HostConfig, Policy, SendMode},
};
use mtp_crypto::PublicKeyBundle;
use mtp::codec::{CommunicationType, CommunicationValue, DataType, DataValue};
use mtp::host::{AuthenticationPolicy, HostConfig, Policy, SendMode};
use mtp::webserver::{MTPWebServer, WebMtpReceiver, WebMtpSender};
use mtp::crypto::PublicKeyBundle;
use std::net::{IpAddr, Ipv4Addr};
use std::{
sync::Arc,
@ -26,17 +24,10 @@ use tokio::{
sync::{Mutex, RwLock},
time::interval,
};
// ============================================================================
// Configuration
// ============================================================================
const CLEANUP_INTERVAL: Duration = Duration::from_secs(30);
const MAX_WAITING_AGE: Duration = Duration::from_secs(60);
// ============================================================================
// Error Types
// ============================================================================
#[derive(Debug, thiserror::Error)]
pub enum OmikronError {
#[error("Not connected")]
@ -55,22 +46,14 @@ pub enum OmikronError {
pub type OmikronResult<T> = Result<T, OmikronError>;
// ============================================================================
// Waiting Task System (Preserved from original)
// ============================================================================
pub struct WaitingTask {
pub task: Box<dyn Fn(Arc<OmikronConnection>, CommunicationValue) -> bool + Send + Sync>,
pub inserted_at: Instant,
}
// ============================================================================
// Omikron Connection (mtp/QUIC-based)
// ============================================================================
pub struct OmikronConnection {
id: u64,
sender: Mutex<Option<Sender>>,
sender: Mutex<Option<WebMtpSender>>,
pub ping: RwLock<i64>,
waiting_tasks: DashMap<u32, WaitingTask>,
cleanup_handle: std::sync::Mutex<Option<tokio::task::JoinHandle<()>>>,
@ -85,11 +68,7 @@ impl Drop for OmikronConnection {
}
impl OmikronConnection {
// -------------------------------------------------------------------------
// Construction
// -------------------------------------------------------------------------
pub fn new(sender: Sender, id: u64) -> Arc<Self> {
pub fn new(sender: WebMtpSender, id: u64) -> Arc<Self> {
let conn = Arc::new(Self {
id,
sender: Mutex::new(Some(sender)),
@ -101,18 +80,13 @@ impl OmikronConnection {
conn
}
// -------------------------------------------------------------------------
// Main Handler Loop
// -------------------------------------------------------------------------
pub async fn handle(self: Arc<Self>, receiver: &mut Receiver) {
pub async fn handle(self: Arc<Self>, receiver: &mut WebMtpReceiver) {
log_in!(
self.id as i64,
PrintType::Omega,
"Omikron connection started"
);
// Start cleanup task
let cleanup_conn = self.clone();
let cleanup_handle = tokio::spawn(async move {
let mut ticker = interval(CLEANUP_INTERVAL);
@ -142,10 +116,6 @@ impl OmikronConnection {
);
}
// -------------------------------------------------------------------------
// Message Processing
// -------------------------------------------------------------------------
async fn process_message(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
if !cv.is_type(CommunicationType::Pong) && !cv.is_type(CommunicationType::Ping) {
log_cv_in!(PrintType::Omikron, &cv);
@ -153,18 +123,15 @@ impl OmikronConnection {
let msg_id = cv.get_id();
// Check waiting tasks first (response to previous request)
if let Some((_, task)) = self.waiting_tasks.remove(&msg_id) {
let _ = (task.task)(self.clone(), cv);
return Ok(());
}
// Handle ping regardless of message type
if cv.is_type(CommunicationType::Ping) {
return self.handle_ping(cv).await;
}
// Authentication is completed by the mtp host before this connection exists.
let omikron_id = self.id as i64;
self.clone().handle_authenticated(cv, omikron_id).await
}
@ -176,10 +143,8 @@ impl OmikronConnection {
) -> OmikronResult<()> {
let comm_type = cv.get_comm_type_enum();
match comm_type {
// Link shortening
Some(CommunicationType::ShortenLink) => self.handle_shorten_link(cv).await,
// Online status tracking
Some(CommunicationType::UserConnected) => {
self.handle_user_connected(cv, omikron_id).await;
Ok(())
@ -234,10 +199,6 @@ impl OmikronConnection {
}
}
// -------------------------------------------------------------------------
// Specific Handlers (ported from original WebSocket implementation)
// -------------------------------------------------------------------------
async fn handle_shorten_link(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
let link = cv
.get_data(DataType::Link)
@ -348,7 +309,6 @@ impl OmikronConnection {
}
async fn handle_get_user_data(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
// Try by user_id first
if let Some(user_id) = cv.get_data(DataType::UserId).as_number() {
if let Ok(user_data) = get_by_user_id(user_id as i64).await {
let response = self
@ -359,7 +319,6 @@ impl OmikronConnection {
}
}
// Try by username
if let Some(username) = cv.get_data(DataType::Username).as_str() {
if let Ok(user_data) = get_by_username(username).await {
let response = self
@ -370,7 +329,6 @@ impl OmikronConnection {
}
}
// Not found
let response =
CommunicationValue::new(CommunicationType::ErrorNotFound).with_id(cv.get_id());
self.send(&response).await
@ -421,11 +379,9 @@ impl OmikronConnection {
)
.add_typed_default(DataType::SubEnd, DataValue::SignedNumber(sub_end.into()));
// Display name (fallback to username)
let display_name = display.filter(|d| !d.is_empty()).unwrap_or(username);
response = response.add_typed_default(DataType::Display, DataValue::Str(display_name));
// Optional fields
if let Some(s) = status.filter(|s| !s.is_empty()) {
response = response.add_typed_default(DataType::Status, DataValue::Str(s));
}
@ -437,7 +393,6 @@ impl OmikronConnection {
response.add_typed_default(DataType::Avatar, DataValue::Str(STANDARD.encode(av)));
}
// Online status
let user_status = user_online_tracker::get_user_status(id);
let iota_connections =
user_online_tracker::get_iota_omikron_connections(iota_id).unwrap_or_default();
@ -477,7 +432,6 @@ impl OmikronConnection {
}
async fn handle_get_iota_data(self: Arc<Self>, cv: CommunicationValue) -> OmikronResult<()> {
// Try by iota_id
if let Some(iota_id) = cv.get_data(DataType::IotaId).as_number() {
if let Ok((iota_id, public_key)) = get_iota_by_id(iota_id as i64).await {
let response = self
@ -488,7 +442,6 @@ impl OmikronConnection {
}
}
// Try by user_id
if let Some(user_id) = cv.get_data(DataType::UserId).as_number() {
if let Ok((_, iota_id, _, _, _, _, _, _, _, _, _, _)) =
get_by_user_id(user_id as i64).await
@ -509,7 +462,6 @@ impl OmikronConnection {
}
}
// Try by username
if let Some(username) = cv.get_data(DataType::Username).as_str() {
if let Ok((user_id, iota_id, _, _, _, _, _, _, _, _, _, _)) =
get_by_username(username).await
@ -594,7 +546,6 @@ impl OmikronConnection {
if let Some(public_key) = public_key {
if let Some(iota_id) = iota_id_opt {
// Register existing IOTA
match sql::register_complete_iota(iota_id, public_key).await {
Ok(_) => {
let response = CommunicationValue::new(CommunicationType::Success)
@ -609,7 +560,6 @@ impl OmikronConnection {
}
}
} else {
// Create new IOTA
match sql::create_new_iota(public_key).await {
Ok(new_iota_id) => {
let response =
@ -681,7 +631,6 @@ impl OmikronConnection {
let mut success = true;
let mut error_message = String::new();
// Process each field
if let Some(username) = cv.get_data(DataType::Username).as_str() {
if let Err(e) = sql::change_username(user_id, username.to_string()).await {
success = false;
@ -747,7 +696,7 @@ impl OmikronConnection {
) {
match sql::get_by_user_id(user_id).await {
Ok(user) => {
let current_token = user.11; // reset_token field
let current_token = user.11;
if current_token == reset_token {
let mut success = true;
let mut error_message = String::new();
@ -889,7 +838,6 @@ impl OmikronConnection {
.with_id(cv.get_id());
let _ = self.send(&response).await;
// Sync with other Omikron clients
let sync_cv = CommunicationValue::new(CommunicationType::ReadNotification)
.with_receiver(receiver_id as u64)
.add_typed_default(
@ -926,7 +874,6 @@ impl OmikronConnection {
CommunicationValue::new(CommunicationType::PushNotification).with_id(cv.get_id());
let _ = self.send(&response).await;
// Sync with other Omikron clients
let push_cv = CommunicationValue::new(CommunicationType::PushNotification)
.with_receiver(receiver_id as u64)
.add_typed_default(
@ -985,10 +932,6 @@ impl OmikronConnection {
self.send(&response).await
}
// -------------------------------------------------------------------------
// Utilities
// -------------------------------------------------------------------------
async fn send(self: Arc<Self>, cv: &CommunicationValue) -> OmikronResult<()> {
if !cv.is_type(CommunicationType::Pong) && !cv.is_type(CommunicationType::Ping) {
log_cv_out!(PrintType::Omikron, cv);
@ -1060,9 +1003,10 @@ pub async fn complete_register(_pub_key: PublicKeyBundle, _description: Option<S
pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
let cert_pem = load_file_vec("certs", "transport_cert.pem").expect("Error loading Pemfile");
let key_pem = load_file_vec("certs", "transport_key.pem").expect("Error loading Keyfile");
let web_config = server::server::build_web_config()?;
let host_config = HostConfig::new(
IpAddr::from(Ipv4Addr::new(0, 0, 0, 0)),
port,
@ -1072,6 +1016,7 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
.with_policy(Policy {
send_mode: SendMode::SingleStreamPerMessage,
max_message_size: 1_000_000_000,
handshake_max_message_size: 1_000_000,
close_frame_len: u32::MAX,
application_close_code: 0,
open_stream_timeout: Duration::from_millis(2_000),
@ -1081,9 +1026,11 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
keep_alive_interval: Some(Duration::from_secs(6)),
max_idle_timeout: Some(Duration::from_secs(30)),
force_close_delay: Duration::from_millis(300),
max_transient_recv_errors: 20,
transient_recv_backoff: Duration::from_millis(100),
receiver_queue_capacity: 1000,
max_concurrent_stream_tasks: 10,
persistent_stream_max_retries: 5,
persistent_stream_retry_backoff: Duration::from_secs(5),
max_frames_per_stream: None,
})
.with_authentication(
load_keyring(),
@ -1092,17 +1039,14 @@ pub async fn start(port: u16) -> Result<(), Box<dyn std::error::Error>> {
)
.with_authentication_policy(AuthenticationPolicy::ForceAuthentication);
let mut host: Host = Host::new(host_config).await?;
log!("OmikronServer listening on port {}", port);
let mut server = MTPWebServer::new(host_config, web_config).await?;
log!("OmegaServer listening on port {}", port);
loop {
let mut conn = match host.accept().await {
let mut conn = match server.accept().await {
Ok(Some(conn)) => conn,
Ok(None) => break,
Err(e) => {
// A single omikron's failed/aborted handshake (bad auth, a
// probe, a mid-handshake disconnect) must not take down the
// whole listener - only that connection attempt is lost.
log_err!(0, PrintType::Omega, "Rejected omikron connection: {}", e);
continue;
}

View file

@ -170,7 +170,7 @@ type_maps:
CallState: 49
ScreenShare: 50
PrivateKeyHash: 51
Accepted: 52
# Accepted: 52 now part of default MTP
AcceptedProfiles: 53
DeniedProfiles: 54
Content: 55