-
Notifications
You must be signed in to change notification settings - Fork 123
Add HTTPConnectionPool Connection as a box type #398
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
Add HTTPConnectionPool Connection as a box type #398
Conversation
enum HTTPConnectionPool { | ||
struct Connection { | ||
struct Connection: Equatable { |
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.
This should be Hashable
.
private enum Reference { | ||
// case http1_1(HTTP1Connection) | ||
|
||
#if DEBUG |
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.
We sometimes want to run tests in release mode: we should probably just define this always and name it to indicate its use in testing.
} | ||
} | ||
|
||
#if DEBUG |
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.
Don't hide this behind debug: use underscores and testOnly
(e.g. __testOnly_channel
.)
f12c141
to
01cce0c
Compare
67b4791
to
0856060
Compare
41e4881
to
77fdb04
Compare
Motivation
In our
HTTPConnectionPool.StateMachine
we want to manage HTTPConnection states. However, to ensure that our state machine reflects the outside world it is beneficial if the state machine would hold references to the actual existing connections. Exposing our Connection types directly to the state machine could lead to abuse though. Developers might call actions directly on the Connection within the state machine.Modifications
HTTPConnectionPool.Connection
type that is a box around an actual connection. The purpose of the box is to ensure no actions are invoked on the connection within the state machine. Further the box can be used for testing the state machine without creating actual connections.Caveats