mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
app_queue: Support persisting and loading of long member lists.
Greenlight in #asterisk brought up that he was receiving an error message "Could not create persistent member string, out of space" when running app_queue in Asterisk 10. dump_queue_members() made an assumption that 8K would be enough to store the generated string, but with queues that have large member lists this is not always the case. This patch removes the limitation and uses ast_str instead of a fixed sized buffer. The complicating factor comes from the fact that ast_db_get requires a buffer and buffer size argument, which doesn't let us pull back more than what we pass in, so I introduced a new ast_db_get_allocated() which returns an ast_strdup()'d copy of the value from astdb. As an aside, I did some testing on the maximum size of data that we can store in the BDB library we distribute and was able to store a 10MB string and retrieve it with no problems, so I feel this is a safe patch. Review: https://reviewboard.asterisk.org/r/2136/ ........ Merged revisions 374108 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 374135 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@374150 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -36,6 +36,17 @@ struct ast_db_entry {
|
||||
/*!\brief Get key value specified by family/key */
|
||||
int ast_db_get(const char *family, const char *key, char *out, int outlen);
|
||||
|
||||
/*!\brief Get key value specified by family/key as a heap allocated string.
|
||||
*
|
||||
* Given a \a family and \a key, sets \a out to a pointer to a heap
|
||||
* allocated string. In the event of an error, \a out will be set to
|
||||
* NULL. The string must be freed by calling ast_free().
|
||||
*
|
||||
* \retval -1 An error occurred
|
||||
* \retval 0 Success
|
||||
*/
|
||||
int ast_db_get_allocated(const char *family, const char *key, char **out);
|
||||
|
||||
/*!\brief Store value addressed by family/key */
|
||||
int ast_db_put(const char *family, const char *key, const char *value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user