Skip to content

Commit

Permalink
Fixing issue with multiple notify channels
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Mar 27, 2024
1 parent 02e25ca commit 39eb6a2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions services/src/tpu_utils/tpu_connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ impl ActiveConnection {
async fn listen(
&self,
mut transaction_reciever: Receiver<SentTransactionInfo>,
exit_notifier: Arc<Notify>,
addr: SocketAddr,
identity_stakes: IdentityStakesData,
) {
let fill_notify = Arc::new(Notify::new());

let identity = self.identity;
let exit_notifier = self.exit_notifier.clone();

NB_QUIC_ACTIVE_CONNECTIONS.inc();

Expand Down Expand Up @@ -224,13 +224,12 @@ impl ActiveConnection {
pub fn start_listening(
&self,
transaction_reciever: Receiver<SentTransactionInfo>,
exit_notifier: Arc<Notify>,
identity_stakes: IdentityStakesData,
) {
let addr = self.tpu_address;
let this = self.clone();
tokio::spawn(async move {
this.listen(transaction_reciever, exit_notifier, addr, identity_stakes)
this.listen(transaction_reciever, addr, identity_stakes)
.await;
});
}
Expand Down Expand Up @@ -276,14 +275,8 @@ impl TpuConnectionManager {
connection_parameters,
);
// using mpsc as a oneshot channel/ because with one shot channel we cannot reuse the reciever
let exit_notifier = Arc::new(Notify::new());

let broadcast_receiver = broadcast_sender.subscribe();
active_connection.start_listening(
broadcast_receiver,
exit_notifier.clone(),
identity_stakes,
);
active_connection.start_listening(broadcast_receiver, identity_stakes);
self.identity_to_active_connection
.insert(*identity, active_connection);
}
Expand Down

0 comments on commit 39eb6a2

Please sign in to comment.