-
Notifications
You must be signed in to change notification settings - Fork 119
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
SplitTunnel 01: Use a factory for creation #9889
Conversation
2d82dfe
to
8521997
Compare
52e42f9
to
606671c
Compare
MZ_COUNT_CTOR(WindowsDaemon); | ||
|
||
m_firewallManager = WindowsFirewall::instance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: Perhaps we could make this WindowsFirewall::create()
or just new WindowsFirewall(this)
to make its initialization call explicit and consistent with the rest of the stuff here (and establish an obvious object ownership hierarchy).
} | ||
// 04: Make sure the Windows Firewall has created the sublayer | ||
// otherwise the driver will fail to initialize | ||
if (!fw || !fw->init()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: I get that this hasn't really changed, but it is kindof odd for the firewall init to be happening here. It would be a little more appropriate for WindowsDaemon
to do the init, and then pass in a reference to the WFP sublayer as an argument to WindowsSplitTunnel::create()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How exactly does the split tunnel driver figure out the WFP sublayer to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Sublayer is hardcoded in the driver...
606671c
to
018ea7a
Compare
Currently you need to create the object and then call the correct functions in order to have an initialized object. Similar to wgnt lets make sure that no "invalid" object can even exist. so that we can assert you will not call i.e. start() on a closed handle. Given that it's not cool to have constructors throw exceptions lets add a create() factory that will spit out nullptr or a working instance. stack-info: PR: #9889, branch: strseb/stack/2
018ea7a
to
a3fc78a
Compare
* SplitTunnel 01: Use a factory for creation Currently you need to create the object and then call the correct functions in order to have an initialized object. Similar to wgnt lets make sure that no "invalid" object can even exist. so that we can assert you will not call i.e. start() on a closed handle. Given that it's not cool to have constructors throw exceptions lets add a create() factory that will spit out nullptr or a working instance. stack-info: PR: #9889, branch: strseb/stack/2 * SplitTunnel 02: remove dupe code in generateIPConfiguration Inline Lambdas are cool, let's use them to reduce dupecode and lets give this function a failstate to bubble that up later to the client. stack-info: PR: #9890, branch: strseb/stack/3
Stacked PRs:
SplitTunnel 01: Use a factory for creation
Currently you need to create the object and then call
the correct functions in order to have an initialized object.
Similar to wgnt lets make sure that no "invalid" object can even exist.
so that we can assert you will not call i.e. start() on a closed handle.
Given that it's not cool to have constructors throw exceptions lets add
a create() factory that will spit out nullptr or a working instance.