mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
net: create session() function that returns an Arc pointer to session
This commit is contained in:
@@ -19,7 +19,7 @@ use crate::{
|
||||
use super::{
|
||||
message,
|
||||
message_subscriber::{MessageSubscription, MessageSubsystem},
|
||||
SessionWeakPtr, TransportStream,
|
||||
Session, SessionWeakPtr, TransportStream,
|
||||
};
|
||||
|
||||
/// Atomic pointer to async channel.
|
||||
@@ -104,10 +104,6 @@ impl Channel {
|
||||
self.info.lock().await.get_info().await
|
||||
}
|
||||
|
||||
//async fn session_type_id(&self) -> Result<()> {
|
||||
// //
|
||||
//}
|
||||
|
||||
/// Starts the channel. Runs a receive loop to start receiving messages or
|
||||
/// handles a network failure.
|
||||
pub fn start(self: Arc<Self>, executor: Arc<Executor<'_>>) {
|
||||
@@ -327,4 +323,8 @@ impl Channel {
|
||||
}
|
||||
debug!(target: "net", "Channel::handle_stop() [END, address={}]", self.address());
|
||||
}
|
||||
|
||||
fn session(&self) -> Arc<dyn Session> {
|
||||
self.session.upgrade().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ pub use message_subscriber::MessageSubscription;
|
||||
pub use p2p::{P2p, P2pPtr};
|
||||
pub use protocol::{ProtocolBase, ProtocolBasePtr, ProtocolJobsManager, ProtocolJobsManagerPtr};
|
||||
pub use session::{
|
||||
SessionWeakPtr, SESSION_ALL, SESSION_INBOUND, SESSION_MANUAL, SESSION_OUTBOUND, SESSION_SEED,
|
||||
Session, SessionWeakPtr, SESSION_ALL, SESSION_INBOUND, SESSION_MANUAL, SESSION_OUTBOUND,
|
||||
SESSION_SEED,
|
||||
};
|
||||
pub use settings::{Settings, SettingsPtr};
|
||||
pub use transport::{
|
||||
|
||||
Reference in New Issue
Block a user