-
Couldn't load subscription status.
- Fork 421
Add Notifier to OnionMessenger
#3194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Notifier to OnionMessenger
#3194
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3194 +/- ##
==========================================
+ Coverage 89.78% 90.95% +1.17%
==========================================
Files 121 122 +1
Lines 100932 109280 +8348
Branches 100932 109280 +8348
==========================================
+ Hits 90619 99395 +8776
+ Misses 7635 7191 -444
- Partials 2678 2694 +16 ☔ View full report in Codecov by Sentry. |
7a7a238 to
134b46b
Compare
|
Need to update the non-async BP too. |
Wat, we still support that? :P (Ah, thanks, good catch!) |
dcadadb to
df38fd5
Compare
|
Let me know if I can squash fixups |
|
Feel free, IMO. |
d934b96 to
b3d45cc
Compare
|
Squashed without further changes (ignore the intermittent force-pushes..): > git diff-tree -U2 e3ed93b2d b3d45ccfd
> |
b3d45cc to
7b8200a
Compare
|
Force-pushed with the following changes: > git diff-tree -U2 b3d45ccfd 7b8200a47
diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs
index 30ad572fd..ec1682bed 100644
--- a/lightning/src/onion_message/messenger.rs
+++ b/lightning/src/onion_message/messenger.rs
@@ -1250,8 +1250,5 @@ where
},
hash_map::Entry::Occupied(mut e) => {
- let notify = e.get_mut().enqueue_message(onion_message);
- if notify {
- self.event_notifier.notify();
- }
+ e.get_mut().enqueue_message(onion_message);
if e.get().is_connected() {
Ok(SendSuccess::Buffered) |
7b8200a to
2dd8c2b
Compare
|
Force-pushed with additional changes (actually reverting prior changes): > git diff-tree -U2 7b8200a47 2dd8c2b3d
diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs
index ec1682bed..590886721 100644
--- a/lightning/src/onion_message/messenger.rs
+++ b/lightning/src/onion_message/messenger.rs
@@ -295,17 +295,11 @@ impl OnionMessageRecipient {
}
- // Returns whether changes were made that are pending event processing
- fn enqueue_message(&mut self, message: OnionMessage) -> bool {
- let mut pending_event_processing = false;
+ fn enqueue_message(&mut self, message: OnionMessage) {
let pending_messages = match self {
OnionMessageRecipient::ConnectedPeer(pending_messages) => pending_messages,
- OnionMessageRecipient::PendingConnection(pending_messages, _, _) => {
- pending_event_processing = true;
- pending_messages
- }
+ OnionMessageRecipient::PendingConnection(pending_messages, _, _) => pending_messages,
};
pending_messages.push_back(message);
- pending_event_processing
}
@@ -1241,9 +1235,7 @@ where
None => Err(SendError::InvalidFirstHop(first_node_id)),
Some(addresses) => {
- let notify = e.insert(OnionMessageRecipient::pending_connection(addresses))
+ e.insert(OnionMessageRecipient::pending_connection(addresses))
.enqueue_message(onion_message);
- if notify {
- self.event_notifier.notify();
- }
+ self.event_notifier.notify();
Ok(SendSuccess::BufferedAwaitingConnection(first_node_id))
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #3190
We add a
NotifiertoOnionMessengerthat allows us to notify the background processor of new events being ready to be handled.