Added _NOTIFICATION_REPORT_ROW_LEN
Added _NOTIFICATION_REPORT_ROW_LEN for gwbuf_alloc based on know row numbers
This commit is contained in:
@ -777,6 +777,7 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
|
|||||||
char hex_setup_info[2 * SHA_DIGEST_LENGTH + 1]="";
|
char hex_setup_info[2 * SHA_DIGEST_LENGTH + 1]="";
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *now_tm;
|
struct tm *now_tm;
|
||||||
|
int report_max_bytes=0;
|
||||||
|
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
|
|
||||||
@ -794,11 +795,12 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
|
|||||||
* allocate gwbuf for data to send
|
* allocate gwbuf for data to send
|
||||||
*
|
*
|
||||||
* each module gives 4 rows
|
* each module gives 4 rows
|
||||||
* product and release rows add 6 rows
|
* product and release rows add 7 rows
|
||||||
* row is 256 bytes long
|
* row is _NOTIFICATION_REPORT_ROW_LEN bytes long
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*buffer = gwbuf_alloc(((n_mod * 4) + 6) * 256);
|
report_max_bytes = ((n_mod * 4) + 7) * (_NOTIFICATION_REPORT_ROW_LEN + 1);
|
||||||
|
*buffer = gwbuf_alloc(report_max_bytes);
|
||||||
|
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -810,33 +812,33 @@ module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *c
|
|||||||
|
|
||||||
data_ptr = (char *)GWBUF_DATA(*buffer);
|
data_ptr = (char *)GWBUF_DATA(*buffer);
|
||||||
|
|
||||||
snprintf(data_ptr, 255, "FEEDBACK_SERVER_UID\t%s\n", hex_setup_info);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "FEEDBACK_SERVER_UID\t%s\n", hex_setup_info);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255, "FEEDBACK_USER_INFO\t%s\n", cfg->feedback_user_info);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "FEEDBACK_USER_INFO\t%s\n", cfg->feedback_user_info == NULL ? "not_set" : cfg->feedback_user_info);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255, "VERSION\t%s\n", MAXSCALE_VERSION);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "VERSION\t%s\n", MAXSCALE_VERSION);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255 * 2, "NOW\t%lu\nPRODUCT\t%s\n", now, "maxscale");
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN * 2, "NOW\t%lu\nPRODUCT\t%s\n", now, "maxscale");
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255, "Uname_sysname\t%s\n", cfg->sysname);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "Uname_sysname\t%s\n", cfg->sysname);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255, "Uname_distribution\t%s\n", cfg->release_info);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "Uname_distribution\t%s\n", cfg->release_info);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
|
|
||||||
while (ptr)
|
while (ptr)
|
||||||
{
|
{
|
||||||
snprintf(data_ptr, 255 * 3, "module_%s_type\t%s\nmodule_%s_version\t%s\n", ptr->module, ptr->type, ptr->module, ptr->version);
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN * 2, "module_%s_type\t%s\nmodule_%s_version\t%s\n", ptr->module, ptr->type, ptr->module, ptr->version);
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
|
|
||||||
if (ptr->info) {
|
if (ptr->info) {
|
||||||
snprintf(data_ptr, 255, "module_%s_api\t%d.%d.%d\n",
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "module_%s_api\t%d.%d.%d\n",
|
||||||
ptr->module,
|
ptr->module,
|
||||||
ptr->info->api_version.major,
|
ptr->info->api_version.major,
|
||||||
ptr->info->api_version.minor,
|
ptr->info->api_version.minor,
|
||||||
ptr->info->api_version.patch);
|
ptr->info->api_version.patch);
|
||||||
|
|
||||||
data_ptr+=strlen(data_ptr);
|
data_ptr+=strlen(data_ptr);
|
||||||
snprintf(data_ptr, 255, "module_%s_releasestatus\t%s\n",
|
snprintf(data_ptr, _NOTIFICATION_REPORT_ROW_LEN, "module_%s_releasestatus\t%s\n",
|
||||||
ptr->module,
|
ptr->module,
|
||||||
ptr->info->status == MODULE_IN_DEVELOPMENT
|
ptr->info->status == MODULE_IN_DEVELOPMENT
|
||||||
? "In Development"
|
? "In Development"
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#define _NOTIFICATION_SEND_PENDING 0
|
#define _NOTIFICATION_SEND_PENDING 0
|
||||||
#define _NOTIFICATION_SEND_OK 1
|
#define _NOTIFICATION_SEND_OK 1
|
||||||
#define _NOTIFICATION_SEND_ERROR 2
|
#define _NOTIFICATION_SEND_ERROR 2
|
||||||
|
#define _NOTIFICATION_REPORT_ROW_LEN 255
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration and usage information data for feeback service
|
* The configuration and usage information data for feeback service
|
||||||
|
Reference in New Issue
Block a user