From 96f2b67003f3bfdf237dd7736ca2b5728bafc9e9 Mon Sep 17 00:00:00 2001 From: nikoPLP Date: Sun, 5 Mar 2023 00:35:25 +0200 Subject: [PATCH] more inline doc --- p2p-broker/src/connection_local.rs | 3 +-- p2p-broker/src/server_ws.rs | 36 +++++++++++++++-------------- p2p-client/src/connection_remote.rs | 2 ++ p2p-client/src/connection_ws.rs | 2 ++ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/p2p-broker/src/connection_local.rs b/p2p-broker/src/connection_local.rs index 9564889..3eccaf7 100644 --- a/p2p-broker/src/connection_local.rs +++ b/p2p-broker/src/connection_local.rs @@ -7,8 +7,7 @@ // notice may not be copied, modified, or distributed except // according to those terms. -//! Connection to a Broker, can be local or remote. -//! If remote, it will use a Stream and Sink of framed messages +//! Local Connection to a Broker use futures::{ ready, diff --git a/p2p-broker/src/server_ws.rs b/p2p-broker/src/server_ws.rs index 63241b6..3392e4c 100644 --- a/p2p-broker/src/server_ws.rs +++ b/p2p-broker/src/server_ws.rs @@ -9,23 +9,25 @@ * according to those terms. */ - use async_std::net::{TcpListener, TcpStream}; - use async_std::sync::Mutex; - use async_std::task; - use async_tungstenite::accept_async; - use async_tungstenite::tungstenite::protocol::Message; - use debug_print::*; - use futures::{SinkExt, StreamExt}; - use crate::broker_store_config::ConfigMode; - use crate::server::*; - use p2p_stores_lmdb::broker_store::LmdbBrokerStore; - use p2p_stores_lmdb::repo_store::LmdbRepoStore; - use std::fs; - use std::sync::Arc; - use tempfile::Builder; - use std::{thread, time}; - - pub async fn connection_loop(tcp: TcpStream, mut handler: ProtocolHandler) -> std::io::Result<()> { +//! WebSocket implementation of the Broker + +use async_std::net::{TcpListener, TcpStream}; +use async_std::sync::Mutex; +use async_std::task; +use async_tungstenite::accept_async; +use async_tungstenite::tungstenite::protocol::Message; +use debug_print::*; +use futures::{SinkExt, StreamExt}; +use crate::broker_store_config::ConfigMode; +use crate::server::*; +use p2p_stores_lmdb::broker_store::LmdbBrokerStore; +use p2p_stores_lmdb::repo_store::LmdbRepoStore; +use std::fs; +use std::sync::Arc; +use tempfile::Builder; +use std::{thread, time}; + +async fn connection_loop(tcp: TcpStream, mut handler: ProtocolHandler) -> std::io::Result<()> { let mut ws = accept_async(tcp).await.unwrap(); let (mut tx, mut rx) = ws.split(); diff --git a/p2p-client/src/connection_remote.rs b/p2p-client/src/connection_remote.rs index 9d11572..4a0dff0 100644 --- a/p2p-client/src/connection_remote.rs +++ b/p2p-client/src/connection_remote.rs @@ -9,6 +9,8 @@ * according to those terms. */ +//! Remote Connection to a Broker + use async_std::task; use async_std::sync::Mutex; use futures::{ diff --git a/p2p-client/src/connection_ws.rs b/p2p-client/src/connection_ws.rs index e3cf2eb..fc36194 100644 --- a/p2p-client/src/connection_ws.rs +++ b/p2p-client/src/connection_ws.rs @@ -9,6 +9,8 @@ * according to those terms. */ +//! WebSocket Remote Connection to a Broker + use debug_print::*; use p2p_repo::types::*;