feat: Add client/server use_channel variants (#228)

The goal here is to make the use of channels when interfacing with nodes less of a black box; the 0x8000 bit flip is a very surprising behavior if you're not already familiar with it.
This commit is contained in:
Pi Lanningham 2023-02-09 15:38:45 -05:00 committed by GitHub
parent 4915d14cd5
commit a81fc101fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 14 deletions

View file

@ -13,8 +13,8 @@ fn main() {
let bearer = Bearer::connect_tcp("relays-new.cardano-testnet.iohkdev.io:3001").unwrap();
let mut plexer = StdPlexer::new(bearer);
let handshake = plexer.use_channel(PROTOCOL_N2N_HANDSHAKE);
let blockfetch = plexer.use_channel(PROTOCOL_N2N_BLOCK_FETCH);
let handshake = plexer.use_client_channel(PROTOCOL_N2N_HANDSHAKE);
let blockfetch = plexer.use_client_channel(PROTOCOL_N2N_BLOCK_FETCH);
plexer.muxer.spawn();
plexer.demuxer.spawn();

View file

@ -78,9 +78,9 @@ fn main() {
// setup the multiplexer by specifying the bearer and the IDs of the
// miniprotocols to use
let mut plexer = multiplexer::StdPlexer::new(bearer);
let handshake = plexer.use_channel(PROTOCOL_N2C_HANDSHAKE);
let statequery = plexer.use_channel(PROTOCOL_N2C_STATE_QUERY);
let chainsync = plexer.use_channel(PROTOCOL_N2C_CHAIN_SYNC);
let handshake = plexer.use_client_channel(PROTOCOL_N2C_HANDSHAKE);
let statequery = plexer.use_client_channel(PROTOCOL_N2C_STATE_QUERY);
let chainsync = plexer.use_client_channel(PROTOCOL_N2C_CHAIN_SYNC);
plexer.muxer.spawn();
plexer.demuxer.spawn();

View file

@ -86,9 +86,9 @@ fn main() {
// setup the multiplexer by specifying the bearer and the IDs of the
// miniprotocols to use
let mut plexer = StdPlexer::new(bearer);
let handshake = plexer.use_channel(PROTOCOL_N2N_HANDSHAKE);
let blockfetch = plexer.use_channel(PROTOCOL_N2N_BLOCK_FETCH);
let chainsync = plexer.use_channel(PROTOCOL_N2N_CHAIN_SYNC);
let handshake = plexer.use_client_channel(PROTOCOL_N2N_HANDSHAKE);
let blockfetch = plexer.use_client_channel(PROTOCOL_N2N_BLOCK_FETCH);
let chainsync = plexer.use_client_channel(PROTOCOL_N2N_CHAIN_SYNC);
plexer.muxer.spawn();
plexer.demuxer.spawn();