add streaming body to requests and responses #3

Merged
lx merged 64 commits from stream-body into main 2022-09-13 10:56:54 +00:00
5 changed files with 9 additions and 10 deletions
Showing only changes of commit 5da59ebec5 - Show all commits

View file

@ -7,7 +7,6 @@ use async_trait::async_trait;
use crate::error::Error; use crate::error::Error;
use crate::message::*; use crate::message::*;
use crate::netapp::*; use crate::netapp::*;
use crate::util::*;
/// This trait should be implemented by an object of your application /// This trait should be implemented by an object of your application
/// that can handle a message of type `M`, if it wishes to handle /// that can handle a message of type `M`, if it wishes to handle

View file

@ -29,7 +29,6 @@ pub mod netapp;
pub mod peering; pub mod peering;
pub use crate::netapp::*; pub use crate::netapp::*;
pub use util::{NetworkKey, NodeID, NodeKey};
#[cfg(test)] #[cfg(test)]
mod test; mod test;

View file

@ -22,7 +22,13 @@ use crate::endpoint::*;
use crate::error::*; use crate::error::*;
use crate::message::*; use crate::message::*;
use crate::server::*; use crate::server::*;
use crate::util::*;
/// A node's identifier, which is also its public cryptographic key
pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey;
/// A node's secret key
pub type NodeKey = sodiumoxide::crypto::sign::ed25519::SecretKey;
/// A network key
pub type NetworkKey = sodiumoxide::crypto::auth::Key;
/// Tag which is exchanged between client and server upon connection establishment /// Tag which is exchanged between client and server upon connection establishment
/// to check that they are running compatible versions of Netapp, /// to check that they are running compatible versions of Netapp,

View file

@ -75,7 +75,7 @@ pub(crate) trait RecvLoop: Sync + 'static {
let has_cont = (size & CHUNK_HAS_CONTINUATION) != 0; let has_cont = (size & CHUNK_HAS_CONTINUATION) != 0;
let is_error = (size & ERROR_MARKER) != 0; let is_error = (size & ERROR_MARKER) != 0;
let packet = if is_error { let packet = if is_error {
Err(size as u8) Err((size & !ERROR_MARKER) as u8)
} else { } else {
let size = size & !CHUNK_HAS_CONTINUATION; let size = size & !CHUNK_HAS_CONTINUATION;
let mut next_slice = vec![0; size as usize]; let mut next_slice = vec![0; size as usize];

View file

@ -6,12 +6,7 @@ use serde::Serialize;
use tokio::sync::watch; use tokio::sync::watch;
/// A node's identifier, which is also its public cryptographic key use crate::netapp::*;
pub type NodeID = sodiumoxide::crypto::sign::ed25519::PublicKey;
/// A node's secret key
pub type NodeKey = sodiumoxide::crypto::sign::ed25519::SecretKey;
/// A network key
pub type NetworkKey = sodiumoxide::crypto::auth::Key;
/// Utility function: encodes any serializable value in MessagePack binary format /// Utility function: encodes any serializable value in MessagePack binary format
/// using the RMP library. /// using the RMP library.