[−][src]Struct p2p::Context
Network context.
Methods
impl Context[src]
impl Contextpub fn new(
local_sync_node: LocalSyncNodeRef,
pool_handle: CpuPool,
remote: Remote,
config: Config
) -> Result<Self, Box<Error>>[src]
pub fn new(
local_sync_node: LocalSyncNodeRef,
pool_handle: CpuPool,
remote: Remote,
config: Config
) -> Result<Self, Box<Error>>Creates new context with reference to local sync node, thread pool and event loop.
pub fn spawn<F>(&self, f: F) where
F: Future + Send + 'static,
F::Item: Send + 'static,
F::Error: Send + 'static, [src]
pub fn spawn<F>(&self, f: F) where
F: Future + Send + 'static,
F::Item: Send + 'static,
F::Error: Send + 'static, Spawns a future using thread pool and schedules execution of it with event loop handle.
pub fn execute_after<F>(&self, duration: Duration, f: F) where
F: FnOnce() + 'static + Send, [src]
pub fn execute_after<F>(&self, duration: Duration, f: F) where
F: FnOnce() + 'static + Send, Schedules execution of function in future. Use wisely, it keeps used objects in memory until after it is resolved.
pub fn node_table_entries(&self) -> Vec<Node>[src]
pub fn node_table_entries(&self) -> Vec<Node>Returns addresses of recently active nodes. Sorted and limited to 1000.
pub fn update_node_table(&self, nodes: Vec<AddressEntry>)[src]
pub fn update_node_table(&self, nodes: Vec<AddressEntry>)Updates node table.
pub fn penalize_node(&self, addr: &SocketAddr)[src]
pub fn penalize_node(&self, addr: &SocketAddr)Penalize node.
pub fn add_node(&self, addr: SocketAddr) -> Result<(), NodeTableError>[src]
pub fn add_node(&self, addr: SocketAddr) -> Result<(), NodeTableError>Adds node to table.
pub fn remove_node(&self, addr: SocketAddr) -> Result<(), NodeTableError>[src]
pub fn remove_node(&self, addr: SocketAddr) -> Result<(), NodeTableError>Removes node from table.
pub fn autoconnect(context: Arc<Context>, handle: &Handle)[src]
pub fn autoconnect(context: Arc<Context>, handle: &Handle)Every 10 seconds check if we have reached maximum number of outbound connections. If not, connect to best peers.
pub fn connect<T>(context: Arc<Context>, socket: SocketAddr) where
T: SessionFactory, [src]
pub fn connect<T>(context: Arc<Context>, socket: SocketAddr) where
T: SessionFactory, Connect to socket using given context.
pub fn connect_normal(context: Arc<Context>, socket: SocketAddr)[src]
pub fn connect_normal(context: Arc<Context>, socket: SocketAddr)ⓘImportant traits for Box<R>pub fn accept_connection_future(
context: Arc<Context>,
stream: TcpStream,
socket: SocketAddr,
handle: &Handle,
config: NetConfig
) -> Box<Future<Item = (), Error = ()> + Send>[src]
pub fn accept_connection_future(
context: Arc<Context>,
stream: TcpStream,
socket: SocketAddr,
handle: &Handle,
config: NetConfig
) -> Box<Future<Item = (), Error = ()> + Send>pub fn accept_connection(
context: Arc<Context>,
stream: TcpStream,
socket: SocketAddr,
config: NetConfig
)[src]
pub fn accept_connection(
context: Arc<Context>,
stream: TcpStream,
socket: SocketAddr,
config: NetConfig
)pub fn listen(
context: Arc<Context>,
handle: &Handle,
config: NetConfig
) -> Result<Box<Future<Item = (), Error = ()> + Send>, Error>[src]
pub fn listen(
context: Arc<Context>,
handle: &Handle,
config: NetConfig
) -> Result<Box<Future<Item = (), Error = ()> + Send>, Error>Starts tcp server and listens for incomming connections.
pub fn on_message(
context: Arc<Context>,
channel: Arc<Channel>
) -> IoFuture<MessageResult<()>>[src]
pub fn on_message(
context: Arc<Context>,
channel: Arc<Channel>
) -> IoFuture<MessageResult<()>>Called on incomming mesage.
pub fn send_to_peer<T>(
context: Arc<Context>,
peer: PeerId,
payload: &T,
serialization_flags: u32
) -> IoFuture<()> where
T: Payload, [src]
pub fn send_to_peer<T>(
context: Arc<Context>,
peer: PeerId,
payload: &T,
serialization_flags: u32
) -> IoFuture<()> where
T: Payload, Send message to a channel with given peer id.
pub fn send_message_to_peer<T>(
context: Arc<Context>,
peer: PeerId,
message: T
) -> IoFuture<()> where
T: AsRef<[u8]> + Send + 'static, [src]
pub fn send_message_to_peer<T>(
context: Arc<Context>,
peer: PeerId,
message: T
) -> IoFuture<()> where
T: AsRef<[u8]> + Send + 'static, pub fn send<T>(
_context: Arc<Context>,
channel: Arc<Channel>,
message: T
) -> IoFuture<()> where
T: AsRef<[u8]> + Send + 'static, [src]
pub fn send<T>(
_context: Arc<Context>,
channel: Arc<Channel>,
message: T
) -> IoFuture<()> where
T: AsRef<[u8]> + Send + 'static, Send message using given channel.
pub fn close_channel(&self, id: PeerId)[src]
pub fn close_channel(&self, id: PeerId)Close channel with given peer info.
pub fn close_channel_with_error(&self, id: PeerId, error: &Error)[src]
pub fn close_channel_with_error(&self, id: PeerId, error: &Error)Close channel with given peer info.
pub fn create_sync_session(
&self,
start_height: i32,
services: Services,
outbound_connection: OutboundSyncConnectionRef
) -> InboundSyncConnectionRef[src]
pub fn create_sync_session(
&self,
start_height: i32,
services: Services,
outbound_connection: OutboundSyncConnectionRef
) -> InboundSyncConnectionRefpub fn connections(&self) -> &Connections[src]
pub fn connections(&self) -> &Connectionspub fn nodes(&self) -> Vec<Node>[src]
pub fn nodes(&self) -> Vec<Node>Auto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T> From for Timpl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>try_from)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow(&self) -> &T[src]
fn borrow(&self) -> &TImmutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>try_from)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, ⓘImportant traits for &'a mut Rfn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut TMutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeId🔬 This is a nightly-only experimental API. (get_type_id)
this method will likely be replaced by an associated static
Gets the TypeId of self. Read more
impl<T> Erased for T
impl<T> Erased for T