SAving, its broken
This commit is contained in:
parent
b15815d12f
commit
efaa36a161
4 changed files with 67 additions and 43 deletions
|
|
@ -53,9 +53,15 @@ pub(crate) struct Peer {
|
|||
}
|
||||
|
||||
impl Peer {
|
||||
pub fn new_live_for_incoming_connection(peer_id: Id20, tx: PeerTx) -> Self {
|
||||
pub fn new_live_for_incoming_connection(
|
||||
peer_id: Id20,
|
||||
tx: PeerTx,
|
||||
counters: &AggregatePeerStatsAtomic,
|
||||
) -> Self {
|
||||
let state = PeerStateNoMut(PeerState::Live(LivePeerState::new(peer_id, tx)));
|
||||
counters.inc(&state.0);
|
||||
Self {
|
||||
state: PeerStateNoMut(PeerState::Live(LivePeerState::new(peer_id, tx))),
|
||||
state,
|
||||
stats: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
@ -118,6 +124,13 @@ impl PeerStateNoMut {
|
|||
std::mem::replace(&mut self.0, new)
|
||||
}
|
||||
|
||||
pub fn get_live(&self) -> Option<&LivePeerState> {
|
||||
match &self.0 {
|
||||
PeerState::Live(l) => Some(l),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_live_mut(&mut self) -> Option<&mut LivePeerState> {
|
||||
match &mut self.0 {
|
||||
PeerState::Live(l) => Some(l),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue