mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-05 05:01:36 +00:00
implemented attributes in mongodb imperial monitor
This commit is contained in:
@@ -817,7 +817,6 @@ void emperor_del(struct uwsgi_instance *c_ui) {
|
||||
while(attr) {
|
||||
struct uwsgi_dyn_dict *tmp = attr;
|
||||
attr = attr->next;
|
||||
if (tmp->key) free(tmp->key);
|
||||
if (tmp->value) free(tmp->value);
|
||||
free(tmp);
|
||||
}
|
||||
@@ -2437,7 +2436,6 @@ void uwsgi_emperor_simple_do_with_attrs(struct uwsgi_emperor_scanner *ues, char
|
||||
while(attr) {
|
||||
struct uwsgi_dyn_dict *tmp = attr;
|
||||
attr = attr->next;
|
||||
if (tmp->key) free(tmp->key);
|
||||
if (tmp->value) free(tmp->value);
|
||||
free(tmp);
|
||||
}
|
||||
@@ -2450,7 +2448,6 @@ void uwsgi_emperor_simple_do_with_attrs(struct uwsgi_emperor_scanner *ues, char
|
||||
while(attr) {
|
||||
struct uwsgi_dyn_dict *tmp = attr;
|
||||
attr = attr->next;
|
||||
if (tmp->key) free(tmp->key);
|
||||
if (tmp->value) free(tmp->value);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
@@ -77,8 +77,17 @@ extern "C" void uwsgi_imperial_monitor_mongodb(struct uwsgi_emperor_scanner *ues
|
||||
if (strlen(socket_name) == 0) socket_name = NULL;
|
||||
|
||||
struct uwsgi_dyn_dict *attrs = NULL;
|
||||
char *attr_key = NULL;
|
||||
char *attr_value = NULL;
|
||||
struct uwsgi_string_list *e_attrs = uwsgi.emperor_collect_attributes;
|
||||
while(e_attrs) {
|
||||
const char *attr_value = p.getStringField(e_attrs->value);
|
||||
if (strlen(attr_value) == 0) attr_value = NULL;
|
||||
if (attr_value) {
|
||||
// the value memory is always reallocated
|
||||
char *value = uwsgi_str((char *)attr_value);
|
||||
uwsgi_dyn_dict_new(&attrs, e_attrs->value, e_attrs->len, value, strlen(value));
|
||||
}
|
||||
e_attrs = NULL;
|
||||
}
|
||||
|
||||
if (attrs) {
|
||||
// attrs will be freed in case of error
|
||||
|
||||
Reference in New Issue
Block a user