event struct types

This commit is contained in:
Robert Habermeier 2016-11-18 12:36:31 +01:00
parent 7bfb9e4003
commit 3fabad5c0f
2 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,40 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Network events and event listeners.
use network::PeerId;
use super::{Status, Capabilities, Announcement};
use transaction::SignedTransaction;
/// Peer connected
pub struct Connect(PeerId, Status, Capabilities);
/// Peer disconnected
pub struct Disconnect(PeerId);
/// Peer announces new capabilities.
pub struct Announcement(PeerId, Announcement);
/// Transactions to be relayed.
pub struct RelayTransactions(Vec<SignedTransaction>);
/// An LES event handler.
pub trait Handler {
fn on_connect(&self, _event: Connect);
}

View File

@ -39,7 +39,8 @@ mod buffer_flow;
mod error; mod error;
mod status; mod status;
pub use self::status::Announcement; pub mod event;
pub use self::status::{Status, Capabilities, Announcement};
const TIMEOUT: TimerToken = 0; const TIMEOUT: TimerToken = 0;
const TIMEOUT_INTERVAL_MS: u64 = 1000; const TIMEOUT_INTERVAL_MS: u64 = 1000;