Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 97d6150

Browse files
committed
LSPS0: Advertise supported protocols
We previously didn't advertise the supported protocols, even if the corresponding service handlers were available.
1 parent e57703c commit 97d6150

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/manager.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,7 @@ where {
122122
let pending_events = Arc::new(EventQueue::new());
123123
let ignored_peers = RwLock::new(HashSet::new());
124124

125-
let lsps0_client_handler = LSPS0ClientHandler::new(
126-
entropy_source.clone(),
127-
Arc::clone(&pending_messages),
128-
Arc::clone(&pending_events),
129-
);
130-
131-
let lsps0_service_handler = if service_config.is_some() {
132-
Some(LSPS0ServiceHandler::new(vec![], Arc::clone(&pending_messages)))
133-
} else {
134-
None
135-
};
125+
let mut supported_protocols = Vec::new();
136126

137127
let lsps2_client_handler = client_config.as_ref().and_then(|config| {
138128
config.lsps2_client_config.map(|config| {
@@ -146,6 +136,11 @@ where {
146136
});
147137
let lsps2_service_handler = service_config.as_ref().and_then(|config| {
148138
config.lsps2_service_config.as_ref().map(|config| {
139+
if let Some(number) =
140+
<LSPS2ServiceHandler<CM> as ProtocolMessageHandler>::PROTOCOL_NUMBER
141+
{
142+
supported_protocols.push(number);
143+
}
149144
LSPS2ServiceHandler::new(
150145
Arc::clone(&pending_messages),
151146
Arc::clone(&pending_events),
@@ -169,6 +164,11 @@ where {
169164
});
170165

171166
let lsps1_service_handler = service_config.as_ref().and_then(|config| {
167+
if let Some(number) =
168+
<LSPS1ServiceHandler<ES> as ProtocolMessageHandler>::PROTOCOL_NUMBER
169+
{
170+
supported_protocols.push(number);
171+
}
172172
config.lsps1_service_config.as_ref().map(|config| {
173173
LSPS1ServiceHandler::new(
174174
entropy_source.clone(),
@@ -181,6 +181,18 @@ where {
181181
})
182182
});
183183

184+
let lsps0_client_handler = LSPS0ClientHandler::new(
185+
entropy_source.clone(),
186+
Arc::clone(&pending_messages),
187+
Arc::clone(&pending_events),
188+
);
189+
190+
let lsps0_service_handler = if service_config.is_some() {
191+
Some(LSPS0ServiceHandler::new(vec![], Arc::clone(&pending_messages)))
192+
} else {
193+
None
194+
};
195+
184196
Self {
185197
pending_messages,
186198
pending_events,

0 commit comments

Comments
 (0)