Change module command parameter types

This commit introduces safe session references that can be handled without
holding locks. This allows the safe searching of sessions with the unique
ID of the session.

Remove the use of raw pointers passed as strings. Change the comments of
the argument types and add more details to the parsing function
documentation.
This commit is contained in:
Markus Makela
2016-11-30 19:32:12 +02:00
parent 994299b4f1
commit adbd666991
5 changed files with 90 additions and 47 deletions

View File

@ -339,4 +339,24 @@ static inline bool session_set_autocommit(SESSION* ses, bool autocommit)
return prev_autocommit;
}
/**
* @brief Get a session reference by ID
*
* This creates an additional reference to a session whose unique ID matches @c id.
*
* @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
*/
SESSION* session_get_ref(int id);
/**
* @brief Release a session reference
*
* @param session Session reference to release
*/
void session_put_ref(SESSION *session);
MXS_END_DECLS