Draft
Conversation
joshoxe
reviewed
Dec 8, 2021
| } | ||
|
|
||
| public SocketConnector CreateSocketConnector(IRCd ircd, ServerElement config) { | ||
| return new SocketConnector(log, ircd, config); |
Collaborator
There was a problem hiding this comment.
This (and SocketListenerFactory) are only really just returning an object conditionless at the moment, I am guessing this is being done with a bigger picture in mind? I can see it nicely abstracts the Log creation but I don't really have the bigger picture in my head at the moment
joshoxe
reviewed
Dec 8, 2021
| public virtual void Stop() { | ||
| if (_started) { | ||
| _ircd.Log.Debug($"Shutting down listener [IP: {Info.Host}, Port: {Info.Port}, TLS: {Info.IsTls}]"); | ||
| log.Debug($"Shutting down listener [IP: {Info.Host}, Port: {Info.Port}, TLS: {Info.IsTls}]"); |
Collaborator
There was a problem hiding this comment.
I can already see that this is so much better than passing around everything inside IRCd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a first draft to demonstrate how we can use factories to inject services into objects which are created after startup.
The factories are created at startup, with necessary services injected, and pass these into the constructors of the objects they create.
In the factories submitted so far, I have injected the Log object to construct SocketListener/SocketConnector. The IRCd class no longer needs to know that these classes require a Log.
Unfortunately I couldn't inject the IRCd class into the factory because it would have been a circular dependency.
Any thoughts?