pub struct AddrManInner {
    pub insecure_rand: RefCell<FastRandomContext>,
    pub n_id_count: i32,
    pub map_info: HashMap<i32, AddrInfo>,
    pub map_addr: HashMap<Service, i32, ServiceHash>,
    pub random: RefCell<Vec<i32>>,
    pub n_tried: i32,
    pub vv_tried: AddrManTriedBucketList,
    pub n_new: i32,
    pub vv_new: AddrManNewBucketList,
    pub n_last_good: i64,
}

Fields§

§insecure_rand: RefCell<FastRandomContext>

| Source of random numbers for randomization | in inner loops |

§n_id_count: i32

| last used nId |

§map_info: HashMap<i32, AddrInfo>

| table with information about all n_ids |

§map_addr: HashMap<Service, i32, ServiceHash>

| find an nId based on its network address | and port. |

§random: RefCell<Vec<i32>>

| randomly-ordered vector of all n_ids | | This is mutable because it is unobservable | outside the class, so any changes to it | (even in const methods) are also | unobservable.

§n_tried: i32

| number of “tried” entries |

§vv_tried: AddrManTriedBucketList

| list of “tried” buckets |

§n_new: i32

| number of (unique) “new” entries |

§vv_new: AddrManNewBucketList

| list of “new” buckets |

§n_last_good: i64

| last time Good was called (memory | only). Initially set to 1 so that “never” is | strictly worse.

Implementations§

source§

impl AddrManInner

source

pub fn add( &mut self, addr: &Address, source: &NetAddr, n_key: &u256, asmap: &Vec<bool>, n_time_penalty: i64 ) -> bool

source§

impl AddrManInner

source

pub fn attempt(&mut self, addr: &Service, count_failure: bool, n_time: i64)

source§

impl AddrManInner

source

pub fn check( &self, consistency_check_ratio: i32, n_key: &u256, asmap: &Vec<bool> )

| Consistency check, taking into account | m_consistency_check_ratio. Will std::abort | if an inconsistency is detected.

source

pub fn force_check_addrman(&self, n_key: &u256, asmap: &Vec<bool>) -> i32

| Perform consistency check, regardless of | m_consistency_check_ratio. | | @returns an error code or zero.

source§

impl AddrManInner

source

pub fn clear_new(&mut self, n_ubucket: usize, n_ubucket_pos: usize)

| Clear a position in a “new” table. This is | the only place where entries are actually | deleted.

source§

impl AddrManInner

source

pub fn connected(&mut self, addr: &Service, n_time: i64)

source§

impl AddrManInner

source

pub fn create( &mut self, addr: &Address, addr_source: &NetAddr, pn_id: Option<*mut i32> ) -> *mut AddrInfo

| Create a new entry and add it to the | internal data structures mapInfo, mapAddr | and vRandom.

source§

impl AddrManInner

source

pub fn delete(&mut self, n_id: i32)

| Delete an entry. It must not be in tried, | and have refcount 0. |

source§

impl AddrManInner

source

pub fn find(&mut self, addr: &Service, pn_id: Option<*mut i32>) -> *mut AddrInfo

| Find an entry. |

source§

impl AddrManInner

source

pub fn get_addr( &self, max_addresses: usize, max_pct: usize, network: Option<Network> ) -> Vec<Address>

source§

impl AddrManInner

source

pub unsafe fn good( &mut self, addr: &Service, test_before_evict: bool, n_time: i64, n_key: &u256, asmap: &Vec<bool>, tried_collisions: *mut HashSet<i32> )

source§

impl AddrManInner

source§

impl AddrManInner

source

pub fn make_tried( &mut self, info: &mut AddrInfo, n_id: i32, n_key: &u256, asmap: &Vec<bool> )

| Move an entry from the “new” table(s) | to the “tried” table |

source§

impl AddrManInner

source

pub unsafe fn resolve_collisions( &mut self, n_key: &u256, asmap: &Vec<bool>, tried_collisions: *mut HashSet<i32> )

source§

impl AddrManInner

source

pub fn select(&self, new_only: bool) -> (Address, i64)

source§

impl AddrManInner

source

pub fn select_tried_collision( &mut self, n_key: &u256, asmap: &Vec<bool>, tried_collisions: &mut HashSet<i32> ) -> (Address, i64)

source§

impl AddrManInner

source

pub fn set_services(&mut self, addr: &Service, n_services: ServiceFlags)

source§

impl AddrManInner

source

pub fn swap_random(&self, n_rnd_pos1: usize, n_rnd_pos2: usize)

| Swap two elements in vRandom. |

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> CastInto<U> for Twhere U: CastFrom<T>,

§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> StaticUpcast<T> for T

§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V