HTTP Proxy: Separate Saving Jump Service Addresses from Message Processing
coneiric opened this issue · 2 comments
By submitting this issue, I confirm the following:
- I have read and understood the contributor guide in kovri-docs.
- I have checked that the issue I am reporting can be replicated or that the feature I am suggesting is not present.
- I have checked opened or recently closed pull requests for existing solutions/implementations to my issue/suggestion.
After IRC collaboration with @anonimal & @brbzull0, it seems to me that HTTPMessage::SaveJumpServiceAddress
should really be its own async proxy handler, HTTPProxyHandler::SaveAddress
.
Refactoring saving addresses as a proxy handler will decouple HTTP message processing from AddressBook
's timer + mutex (allowing us to get rid of the hack needed in #838).
Would it be better design to have the handler send the address over the socket as a NetDB , or directly insert to the AddressBook?DatabaseStoreMessage
edit: NetDB is a different submodule, should insert to AddressBook from an async proxy handler, after verifying the address is reachable. Thanks for clarification over IRC @anonimal 👍
Thought you might have been hinting at the former on IRC @anonimal (was mistaken, see above):
@anonimal Right off the bat, IMHO that should be at least 4 different classes. The socket/handler could hypothetically be templated, not specific to HTTP but we'll ignore that for now.
@anonimal From there you can almost certainly decouple the work even further.
@anonimal In that scheme, I don't see a reliance on inheritance but really there are multiple ways to deal with the issue.
@anonimal Did that make sense?
@anonimal Notice how I left out addressbook and storage, etc. This is intentional.