MXS-2196: Remove the dummy session

As each connection now immediately gets a session the dummy session is no
longer required. The next step would be to combine parts of the session
and the client DCB into one entity. This would prevent the possibility of
a client DCB with no associated session. Backend DCBs are different as
they can move from one session to another when the persistent connection
pool is in use.
This commit is contained in:
Markus Mäkelä
2018-12-03 13:18:42 +02:00
parent a2f5cc9d09
commit 692127a2cb
9 changed files with 70 additions and 161 deletions

View File

@ -41,7 +41,6 @@ typedef enum
SESSION_STATE_LISTENER_STOPPED, /*< for listener session */
SESSION_STATE_TO_BE_FREED, /*< ready to be freed as soon as there are no references */
SESSION_STATE_FREE, /*< for all sessions */
SESSION_STATE_DUMMY /*< dummy session for consistency */
} mxs_session_state_t;
#define STRSESSIONSTATE(s) \
@ -79,14 +78,7 @@ typedef enum
SESSION_STATE_FREE \
? \
"SESSION_STATE_TO_BE_FREE" \
: (( \
s) \
== \
SESSION_STATE_DUMMY \
? \
"SESSION_STATE_DUMMY" \
: \
"SESSION_STATE_UNKNOWN")))))))))
: "SESSION_STATE_UNKNOWN"))))))))
typedef enum
{
@ -207,6 +199,9 @@ typedef char* (* session_variable_handler_t)(void* context,
*/
struct MXS_SESSION
{
MXS_SESSION(DCB* client_dcb);
~MXS_SESSION();
mxs_session_state_t state; /*< Current descriptor state */
uint64_t ses_id; /*< Unique session identifier */
DCB* client_dcb; /*< The client connection */
@ -304,13 +299,6 @@ MXS_SESSION* session_alloc(SERVICE*, DCB*);
*/
bool session_start(MXS_SESSION* session);
MXS_SESSION* session_set_dummy(DCB*);
static inline bool session_is_dummy(MXS_SESSION* session)
{
return session->state == SESSION_STATE_DUMMY;
}
const char* session_get_remote(const MXS_SESSION*);
const char* session_get_user(const MXS_SESSION*);