If a DCB is expecting a response from the server, it must not be placed
into the connection pool. This prevents the case where unexpected
responses would be delivered to DCBs taken out of the connection pool.
The header depended on ssl.hh to include the OpenSSL headers even though
it used OpenSSL types. By fixing these dependencies the ssl.h header can
now freely include the rworker_local type which removes the need for the
hidden implementation of SSLProvider.
Formatted with nl_func_type_name and related options set to ignore. This
keeps the formatting intact for long return types in declarations and
definitions.
Allocating the session before a DCB guarantees that at no point will a DCB
have a null session. This further clarifies the concept of the session and
also allows the listener reference to be moved there.
Ideally, the session itself would allocate and assign the client DCB but
since the Listener is the only one who does it, it's acceptable for now.
More of the DCB initialization is now done in the DCB constructor. This
makes the creation of new DCBs simpler but it can be even simpler. By
passing the file descriptor that the DCB should use into the constructor
almost all of the initialization would be done inside it.
Also removed the unused path member variable.
Moved the code into listener.cc as it's the only place where it is
used. Placed the DCB callback assignment into the DCB constructor as it
depended on static functions that were in dcb.cc.
By storing the reference in the DCB, the two-way dependency between the
listeners and services is severed. Now the services have no direct link to
listeners and after the destruction of a listener it will be freed once
all connections through it have closed.
Due to the fact that a listener itself has a DCB that must point to a
valid listener, a self-reference is stored in the listener DCB. This is
extremely confusing and is only here to keep the code functional until the
DCB part of the listener can be factored out.
Allocating DCB with new allows the use of C++ objects in the DCB
struct. Also the explicit poll field can be replaced by inheriting from
MXB_POLL_DATA.