Remove direct freeing of sessions

Sessions are now always freed by releasing the last reference to it.
This commit is contained in:
Markus Makela
2016-12-02 14:39:32 +02:00
parent b2e11d41d5
commit a4bc575353
5 changed files with 36 additions and 38 deletions

View File

@ -204,7 +204,6 @@ typedef struct session
SESSION *session_alloc(struct service *, struct dcb *);
SESSION *session_set_dummy(struct dcb *);
bool session_free(SESSION *);
int session_isvalid(SESSION *);
int session_reply(void *inst, void *session, GWBUF *data);
char *session_get_remote(SESSION *);
@ -347,10 +346,22 @@ static inline bool session_set_autocommit(SESSION* ses, bool autocommit)
* @param id Unique session ID
* @return Reference to a SESSION or NULL if the session was not found
*
* @note The caller must free the session reference by passing it to the
* @c session_put_ref function
* @note The caller must free the session reference by calling session_put_ref
*/
SESSION* session_get_ref(int id);
SESSION* session_get_by_id(int id);
/**
* @brief Get a session reference
*
* This creates an additional reference to a session which allows it to live
* as long as it is needed.
*
* @param session Session reference to get
* @return Reference to a SESSION
*
* @note The caller must free the session reference by calling session_put_ref
*/
SESSION* session_get_ref(SESSION *sessoin);
/**
* @brief Release a session reference