@@ -151,19 +151,21 @@ pub(crate) fn relay_bridge_channels(
151151 } ) ;
152152}
153153
154- /// Spawn the relay instruction fan-out task for a source connection.
154+ /// Spawn the relay fan-out task for a source connection.
155155///
156- /// Reads instructions from `source_rx` and forwards a clone of each to all
157- /// currently-registered peer senders. Returns a registration channel: callers
158- /// send a new `Sender` for each exit peer that connects.
159- pub ( crate ) fn spawn_fanout_task (
160- source_rx : mpsc:: Receiver < wallhack_wire:: data:: EntryNodeInstruction > ,
161- ) -> mpsc:: UnboundedSender < mpsc:: Sender < wallhack_wire:: data:: EntryNodeInstruction > > {
162- let ( register_tx, mut register_rx) =
163- mpsc:: unbounded_channel :: < mpsc:: Sender < wallhack_wire:: data:: EntryNodeInstruction > > ( ) ;
156+ /// The fan-out task reads items from `source_rx` and forwards a clone of each
157+ /// to all currently-registered peer senders. Returns a registration channel:
158+ /// callers send a new `mpsc::Sender<T>` for each peer that connects.
159+ pub ( crate ) fn spawn_fanout_task < T > (
160+ source_rx : mpsc:: Receiver < T > ,
161+ ) -> mpsc:: UnboundedSender < mpsc:: Sender < T > >
162+ where
163+ T : Clone + Send + ' static ,
164+ {
165+ let ( register_tx, mut register_rx) = mpsc:: unbounded_channel :: < mpsc:: Sender < T > > ( ) ;
164166
165167 tokio:: spawn ( async move {
166- let mut peers: Vec < mpsc:: Sender < wallhack_wire :: data :: EntryNodeInstruction > > = Vec :: new ( ) ;
168+ let mut peers: Vec < mpsc:: Sender < T > > = Vec :: new ( ) ;
167169 let mut source_rx = source_rx;
168170
169171 loop {
0 commit comments