|
@@ -140,7 +140,7 @@ static inline str* kz_str_dup(str* src)
|
|
{
|
|
{
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+src->len+1);
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+src->len+1);
|
|
if (!dst_char) {
|
|
if (!dst_char) {
|
|
- LM_ERR("error allocating shared memory for str");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
str* dst = (str*)dst_char;
|
|
str* dst = (str*)dst_char;
|
|
@@ -157,7 +157,7 @@ static inline str* kz_str_dup_from_char(char* src)
|
|
int len = strlen(src);
|
|
int len = strlen(src);
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+len+1);
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+len+1);
|
|
if (!dst_char) {
|
|
if (!dst_char) {
|
|
- LM_ERR("error allocating shared memory for str");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
str* dst = (str*)dst_char;
|
|
str* dst = (str*)dst_char;
|
|
@@ -216,7 +216,7 @@ static inline str* kz_local_str_dup(str* src)
|
|
{
|
|
{
|
|
char *dst_char = (char*)pkg_malloc(sizeof(str)+src->len+1);
|
|
char *dst_char = (char*)pkg_malloc(sizeof(str)+src->len+1);
|
|
if (!dst_char) {
|
|
if (!dst_char) {
|
|
- LM_ERR("error allocating shared memory for str");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
str* dst = (str*)dst_char;
|
|
str* dst = (str*)dst_char;
|
|
@@ -247,7 +247,7 @@ static inline str* kz_str_from_amqp_bytes(amqp_bytes_t src)
|
|
{
|
|
{
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+src.len+1);
|
|
char *dst_char = (char*)shm_malloc(sizeof(str)+src.len+1);
|
|
if (!dst_char) {
|
|
if (!dst_char) {
|
|
- LM_ERR("error allocating shared memory for str");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
str* dst = (str*)dst_char;
|
|
str* dst = (str*)dst_char;
|
|
@@ -1531,7 +1531,7 @@ kz_amqp_queue_ptr kz_amqp_queue_new(str *name)
|
|
{
|
|
{
|
|
kz_amqp_queue_ptr queue = (kz_amqp_queue_ptr) shm_malloc(sizeof(kz_amqp_queue));
|
|
kz_amqp_queue_ptr queue = (kz_amqp_queue_ptr) shm_malloc(sizeof(kz_amqp_queue));
|
|
if(queue == NULL) {
|
|
if(queue == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
memset(queue, 0, sizeof(kz_amqp_queue));
|
|
memset(queue, 0, sizeof(kz_amqp_queue));
|
|
@@ -1558,7 +1558,7 @@ kz_amqp_queue_ptr kz_amqp_queue_from_json(str *name, json_object* json_obj)
|
|
kz_amqp_queue_ptr queue = kz_amqp_queue_new(name);
|
|
kz_amqp_queue_ptr queue = kz_amqp_queue_new(name);
|
|
|
|
|
|
if(queue == NULL) {
|
|
if(queue == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1601,7 +1601,7 @@ kz_amqp_exchange_ptr kz_amqp_exchange_new(str *name, str* type)
|
|
{
|
|
{
|
|
kz_amqp_exchange_ptr exchange = (kz_amqp_exchange_ptr) shm_malloc(sizeof(kz_amqp_exchange));
|
|
kz_amqp_exchange_ptr exchange = (kz_amqp_exchange_ptr) shm_malloc(sizeof(kz_amqp_exchange));
|
|
if(exchange == NULL) {
|
|
if(exchange == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
memset(exchange, 0, sizeof(kz_amqp_exchange));
|
|
memset(exchange, 0, sizeof(kz_amqp_exchange));
|
|
@@ -1646,7 +1646,7 @@ kz_amqp_exchange_ptr kz_amqp_exchange_from_json(str *name, json_object* json_obj
|
|
|
|
|
|
exchange = kz_amqp_exchange_new(name, &type);
|
|
exchange = kz_amqp_exchange_new(name, &type);
|
|
if(exchange == NULL) {
|
|
if(exchange == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1723,7 +1723,7 @@ kz_amqp_routings_ptr kz_amqp_routing_from_json(json_object* json_obj)
|
|
break;
|
|
break;
|
|
|
|
|
|
default:
|
|
default:
|
|
- LM_DBG("type not handled in routing");
|
|
|
|
|
|
+ LM_DBG("type not handled in routing\n");
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
@@ -1765,7 +1765,7 @@ kz_amqp_exchange_binding_ptr kz_amqp_exchange_binding_from_json(json_object* JOb
|
|
binding->from_exchange = exchange;
|
|
binding->from_exchange = exchange;
|
|
binding->routing = kz_amqp_routing_from_json(routingObj);
|
|
binding->routing = kz_amqp_routing_from_json(routingObj);
|
|
if(binding->routing == NULL) {
|
|
if(binding->routing == NULL) {
|
|
- LM_DBG("invalid routing");
|
|
|
|
|
|
+ LM_DBG("invalid routing\n");
|
|
kz_amqp_exchange_bindings_free(binding);
|
|
kz_amqp_exchange_bindings_free(binding);
|
|
binding = NULL;
|
|
binding = NULL;
|
|
} else {
|
|
} else {
|
|
@@ -2371,7 +2371,7 @@ void kz_amqp_consumer_event(kz_amqp_consumer_delivery_ptr Evt)
|
|
if(kz_amqp_consumer_fire_event(buffer) != 0) {
|
|
if(kz_amqp_consumer_fire_event(buffer) != 0) {
|
|
sprintf(buffer, "kazoo:consumer-event");
|
|
sprintf(buffer, "kazoo:consumer-event");
|
|
if(kz_amqp_consumer_fire_event(buffer) != 0) {
|
|
if(kz_amqp_consumer_fire_event(buffer) != 0) {
|
|
- LM_ERR("kazoo:consumer-event not found");
|
|
|
|
|
|
+ LM_ERR("kazoo:consumer-event not found\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2401,7 +2401,7 @@ void kz_amqp_send_consumer_event_ex(char* payload, char* event_key, char* event_
|
|
{
|
|
{
|
|
kz_amqp_consumer_delivery_ptr ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
kz_amqp_consumer_delivery_ptr ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
if(ptr == NULL) {
|
|
if(ptr == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|
|
@@ -2467,7 +2467,7 @@ int kz_send_worker_error_event(kz_amqp_cmd_ptr cmd)
|
|
cmd->return_code = -1;
|
|
cmd->return_code = -1;
|
|
kz_amqp_consumer_delivery_ptr ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
kz_amqp_consumer_delivery_ptr ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
if(ptr == NULL) {
|
|
if(ptr == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|
|
@@ -2997,7 +2997,7 @@ void kz_amqp_send_worker_event(kz_amqp_server_ptr server_ptr, amqp_envelope_t* e
|
|
|
|
|
|
ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
ptr = (kz_amqp_consumer_delivery_ptr) shm_malloc(sizeof(kz_amqp_consumer_delivery));
|
|
if(ptr == NULL) {
|
|
if(ptr == NULL) {
|
|
- LM_ERR("NO MORE SHARED MEMORY!");
|
|
|
|
|
|
+ SHM_MEM_ERROR;
|
|
goto error;
|
|
goto error;
|
|
}
|
|
}
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|
|
memset(ptr, 0, sizeof(kz_amqp_consumer_delivery));
|