Module server

Module server 

Source
Expand description

start the bootstrapping system using start_bootstrap_server Once your node will be ready, you may want other to bootstrap from you.

ยงListener

Runs in the server-dedication tokio async runtime Accepts bootstrap connections in an async-loop Upon connection, pushes the accepted connection onto a channel for the worker loop to consume

ยงUpdater

Runs on a dedicated thread. Signal sent my manager stop method terminates the thread. Shares an Arc<RwLock>> guarded list of white and blacklists with the main worker. Periodically does a read-only check to see if list needs updating. Creates an updated list then swaps it out with write-locked list Assuming no errors in code, this is the only write occurrence, and is only a pointer-swap under the hood, making write contention virtually non-existent.

ยงWorker loop

  1. Checks if the stopper has been invoked.
  2. Checks if the client is permitted under the white/black list rules
  3. Checks if there are not too many active sessions already
  4. Checks if the client has attempted too recently
  5. All checks have passed: spawn a thread on which to run the bootstrap session This thread creates a new tokio runtime, and runs it with block_on

Structsยง

BootstrapManager
handle on the bootstrap server
BootstrapServer ๐Ÿ”’

Functionsยง

manage_bootstrap ๐Ÿ”’
run_bootstrap_session ๐Ÿ”’
To be called from a thread::spawn invocation
start_bootstrap_server
See module level documentation for details
step_timeout_duration ๐Ÿ”’
stream_bootstrap_information