Skip to content
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

Refactor AsyncDelegate<T> #3998

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

greymistcube
Copy link
Contributor

@greymistcube greymistcube commented Nov 25, 2024

Rationale:

  • Considering how AsyncDelegate is used, there should be no need for higher level objects such as Swarm, KademliaProtocol, or Gossip to know Message.Identity.
  • Note that the entire call stack for retrieving reply Messages via AsyncDelegate is under the context of ReceiveMessage(). Although Message.Identity is used as an earmark for dispatching reply Messages internally for an ITransport, this design is only due to how Messages are encoded which in turn is due to the design of NetMQ.

PS - I think it might even be better for the delegate to be of the form Func<BoundPeer, MessageContent, Channel<MessageContent>, Task> instead of Func<Message, Channel<MessageContent>, Task> if we can be sure if other layers shouldn't really care about Message.Timestamp or Message.Version. 🙄

@greymistcube greymistcube force-pushed the refactor/processmessagehandler branch from 3da01a1 to dd93cf4 Compare November 25, 2024 09:15
@greymistcube greymistcube self-assigned this Nov 25, 2024
@greymistcube greymistcube force-pushed the refactor/processmessagehandler branch from af0505c to 7c26f68 Compare November 25, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant