diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f463bb3ebf..bd080327967 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: toolchain: stable override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 with: key: ${{ matrix.crate }} @@ -96,7 +96,7 @@ jobs: override: true target: ${{ matrix.target }} - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - run: cargo check --package libp2p --all-features --target=${{ matrix.target }} @@ -120,7 +120,7 @@ jobs: toolchain: stable override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 with: key: ${{ matrix.runtime }} @@ -141,7 +141,7 @@ jobs: toolchain: stable override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - name: Check rustdoc links run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items @@ -168,7 +168,7 @@ jobs: override: true components: clippy - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - name: Run cargo clippy uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 @@ -190,7 +190,7 @@ jobs: toolchain: stable override: true - - uses: Swatinem/rust-cache@22c9328bcba27aa81a32b1bef27c7e3c78052531 # v2.0.1 + - uses: Swatinem/rust-cache@b894d59a8d236e2979b247b80dac8d053ab340dd # v2.1.0 - name: Run ipfs-kad example run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad --features full diff --git a/swarm/src/behaviour.rs b/swarm/src/behaviour.rs index 385b7eaf0a3..da24302343d 100644 --- a/swarm/src/behaviour.rs +++ b/swarm/src/behaviour.rs @@ -140,7 +140,7 @@ pub trait NetworkBehaviour: 'static { /// /// Note that the handler is returned to the [`NetworkBehaviour`] on connection failure and /// connection closing. - fn new_handler(&mut self) -> Self::ConnectionHandler; + fn new_handler(&mut self, initial_event: Option>) -> Self::ConnectionHandler; /// Addresses that this behaviour is aware of for this specific peer, and that may allow /// reaching the peer. @@ -484,7 +484,7 @@ pub enum NetworkBehaviourAction< /// # #[derive(Debug, PartialEq, Eq)] /// # struct PreciousMessage(String); /// ``` - Dial { opts: DialOpts, handler: THandler }, + Dial { opts: DialOpts, initial_event: TInEvent }, /// Instructs the `Swarm` to send an event to the handler dedicated to a /// connection with a peer. diff --git a/swarm/src/lib.rs b/swarm/src/lib.rs index 6fbff5db6b4..c36dedbe40e 100644 --- a/swarm/src/lib.rs +++ b/swarm/src/lib.rs @@ -375,7 +375,7 @@ where fn dial_with_handler( &mut self, swarm_dial_opts: DialOpts, - handler: ::ConnectionHandler, + initial_in_event: <<::ConnectionHandler>::Handler>::InEvent, ) -> Result<(), DialError> { let (peer_id, addresses, dial_concurrency_factor_override, role_override) = match swarm_dial_opts.0 {