fix: avoid sending relay callbacks if relay is disabled #3276
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When we attempt to start a node with Relay disabled using libwaku, the node creation fails because we attempt to set Relay app callbacks while having Relay disabled.
We should not attempt to configure Relay related callbacks if Relay is disabled.
Added a fix to send
nil
for the Relay related callbacks in case Relay is disabled.Notice that I override the callbacks instead of configuring them to
nil
in the first place, and that's because when we set the callbacks, we still don't have the configuration parsed and it's not trivial to parse. I also attempted to set the callbacks after parsing the configuration but I got into a circular dependency error.Therefore, I'm just adjusting which callbacks to actually send the moment we have the configuration parsed.
Changes
nil
in case Relay is disabledIssue
#3076