remove debugging prints

This commit is contained in:
dr-frmr 2024-05-28 23:30:09 -06:00
parent 08ea80e13d
commit 42f641c8c5
No known key found for this signature in database
7 changed files with 0 additions and 26 deletions

View File

@ -27,8 +27,6 @@ pub fn _verify_auth_token(auth_token: &str, jwt_secret: &[u8]) -> Result<String,
return Err(jwt::Error::Format);
};
println!("hello\r");
let claims: Result<JwtClaims, jwt::Error> = auth_token.verify_with_key(&secret);
match claims {

View File

@ -7,7 +7,6 @@ use tokio::sync::mpsc;
/// if target is a peer, queue to be routed
/// otherwise, create peer and initiate routing
pub async fn send_to_peer(ext: &IdentityExt, data: &NetData, km: KernelMessage) {
// println!("send_to_peer\r");
if let Some(peer) = data.peers.get_mut(&km.target.node) {
peer.sender.send(km).expect("net: peer sender was dropped");
} else {
@ -46,7 +45,6 @@ async fn connect_to_peer(
peer_id: Identity,
peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) {
println!("connect_to_peer\r");
if peer_id.is_direct() {
utils::print_debug(
&ext.print_tx,
@ -81,7 +79,6 @@ async fn connect_via_router(
peer_id: &Identity,
mut peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) {
println!("connect_via_router\r");
let routers_shuffled = {
let mut routers = match peer_id.routing {
NodeRouting::Routers(ref routers) => routers.clone(),
@ -131,7 +128,6 @@ pub async fn handle_failed_connection(
peer_id: &Identity,
mut peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) {
println!("handle_failed_connection\r");
utils::print_debug(
&ext.print_tx,
&format!("net: failed to connect to {}", peer_id.name),

View File

@ -4,7 +4,6 @@ use lib::types::core::{Identity, NodeRouting};
use tokio::{sync::mpsc, time};
pub async fn maintain_routers(ext: IdentityExt, data: NetData) -> anyhow::Result<()> {
println!("maintain_routers\r");
let NodeRouting::Routers(ref routers) = ext.our.routing else {
return Err(anyhow::anyhow!("net: no routers to maintain"));
};
@ -25,7 +24,6 @@ pub async fn maintain_routers(ext: IdentityExt, data: NetData) -> anyhow::Result
}
pub async fn connect_to_router(router_id: &Identity, ext: &IdentityExt, data: &NetData) {
println!("connect_to_router\r");
utils::print_debug(
&ext.print_tx,
&format!("net: attempting to connect to router {}", router_id.name),

View File

@ -34,7 +34,6 @@ pub async fn networking(
kernel_message_rx: MessageReceiver,
_reveal_ip: bool, // only used if indirect
) -> anyhow::Result<()> {
println!("networking\r\n");
let ext = IdentityExt {
our: Arc::new(our),
our_ip: Arc::new(our_ip),
@ -116,7 +115,6 @@ async fn local_recv(
mut kernel_message_rx: MessageReceiver,
data: NetData,
) -> anyhow::Result<()> {
println!("local_recv\r\n");
while let Some(km) = kernel_message_rx.recv().await {
if km.target.node == ext.our.name {
// handle messages sent to us
@ -306,7 +304,6 @@ async fn handle_remote_request(
request_body: &[u8],
data: &NetData,
) -> anyhow::Result<()> {
println!("handle_remote_request\r");
match rmp_serde::from_slice::<NetAction>(request_body) {
Ok(NetAction::KnsBatchUpdate(_)) | Ok(NetAction::KnsUpdate(_)) => {
// for now, we don't get these from remote, only locally.

View File

@ -82,7 +82,6 @@ pub async fn init_direct(
proxy_request: bool,
peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) -> Result<(), mpsc::UnboundedReceiver<KernelMessage>> {
println!("tcp_init_direct\r");
match time::timeout(
TIMEOUT,
connect_with_handshake(ext, peer_id, port, None, proxy_request),
@ -113,7 +112,6 @@ pub async fn init_routed(
router_port: u16,
peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) -> Result<(), mpsc::UnboundedReceiver<KernelMessage>> {
println!("tcp_init_routed\r");
match time::timeout(
TIMEOUT,
connect_with_handshake(ext, peer_id, router_port, Some(router_id), false),
@ -148,7 +146,6 @@ async fn recv_connection(
data: NetData,
mut stream: TcpStream,
) -> anyhow::Result<()> {
println!("tcp_recv_connection\r");
// before we begin XX handshake pattern, check first message over socket
let (len, first_message) = utils::recv_raw(&mut stream).await?;
@ -235,7 +232,6 @@ async fn connect_with_handshake(
use_router: Option<&Identity>,
proxy_request: bool,
) -> anyhow::Result<PeerConnection> {
println!("tcp_connect_with_handshake\r");
let ip = match use_router {
None => peer_id
.get_ip()
@ -315,7 +311,6 @@ pub async fn recv_via_router(
peer_id: Identity,
router_id: Identity,
) {
println!("tcp_recv_via_router\r");
let Some((ip, port)) = router_id.tcp_routing() else {
return;
};
@ -358,7 +353,6 @@ async fn connect_with_handshake_via_router(
router_id: &Identity,
mut stream: TcpStream,
) -> anyhow::Result<PeerConnection> {
println!("tcp_connect_with_handshake_via_router\r");
// before beginning XX handshake pattern, send a routing request
utils::send_raw(
&mut stream,

View File

@ -36,7 +36,6 @@ pub async fn create_passthrough(
pending_passthroughs: &PendingPassthroughs,
socket_1: PendingStream,
) -> anyhow::Result<()> {
println!("create_passthrough\r");
// if the target has already generated a pending passthrough for this source,
// immediately match them
if let Some(((_target, _from), pending_stream)) =
@ -111,7 +110,6 @@ pub async fn create_passthrough(
/// cross the streams -- spawn on own task
pub async fn maintain_passthrough(socket_1: PendingStream, socket_2: PendingStream) {
println!("maintain_passthrough\r");
match (socket_1, socket_2) {
(PendingStream::Tcp(socket_1), PendingStream::Tcp(socket_2)) => {
// do not use bidirectional because if one side closes,
@ -204,7 +202,6 @@ pub fn validate_routing_request(
buf: &[u8],
pki: &OnchainPKI,
) -> anyhow::Result<(Identity, Identity)> {
println!("validate_routing_request\r");
let routing_request: RoutingRequest = rmp_serde::from_slice(buf)?;
let from_id = pki
.get(&routing_request.source)

View File

@ -95,7 +95,6 @@ pub async fn init_direct(
proxy_request: bool,
peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) -> Result<(), mpsc::UnboundedReceiver<KernelMessage>> {
println!("init_direct\r");
match time::timeout(
TIMEOUT,
connect_with_handshake(ext, peer_id, port, None, proxy_request),
@ -126,7 +125,6 @@ pub async fn init_routed(
router_port: u16,
peer_rx: mpsc::UnboundedReceiver<KernelMessage>,
) -> Result<(), mpsc::UnboundedReceiver<KernelMessage>> {
println!("init_routed\r");
match time::timeout(
TIMEOUT,
connect_with_handshake(ext, peer_id, router_port, Some(router_id), false),
@ -164,7 +162,6 @@ pub async fn recv_via_router(
peer_id: Identity,
router_id: Identity,
) {
println!("recv_via_router\r");
let Some((ip, port)) = router_id.ws_routing() else {
return;
};
@ -206,7 +203,6 @@ async fn recv_connection(
data: NetData,
mut socket: WebSocket,
) -> anyhow::Result<()> {
println!("recv_connection\r");
// before we begin XX handshake pattern, check first message over socket
let first_message = &utils::recv(&mut socket).await?;
@ -293,7 +289,6 @@ async fn connect_with_handshake(
use_router: Option<&Identity>,
proxy_request: bool,
) -> anyhow::Result<PeerConnection> {
println!("connect_with_handshake\r");
let mut buf = vec![0u8; 65535];
let (mut noise, our_static_key) = build_initiator();
@ -375,7 +370,6 @@ async fn connect_with_handshake_via_router(
router_id: &Identity,
mut socket: WebSocketStream<MaybeTlsStream<TcpStream>>,
) -> anyhow::Result<PeerConnection> {
println!("connect_with_handshake_via_router\r");
// before beginning XX handshake pattern, send a routing request
socket
.send(tungstenite::Message::binary(rmp_serde::to_vec(