Преглед на файлове

mqueue: fix mq_size() not to return 0

- return 0 for a config function is considered 'exit' by interpreter
- if size of the queue is 0, the function return -1
- for other error cases, the return code was decremented by 1
Daniel-Constantin Mierla преди 10 години
родител
ревизия
bde57b5338
променени са 2 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. 3 2
      modules/mqueue/mqueue_api.c
  2. 2 1
      modules/mqueue/mqueue_mod.c

+ 3 - 2
modules/mqueue/mqueue_api.c

@@ -480,8 +480,9 @@ int pv_get_mq_size(struct sip_msg *msg, pv_param_t *param,
 
 	return pv_get_sintval(msg, param, res, mqs);
 }
-/* Return head->csize for a given queue */
-
+/**
+ * Return head->csize for a given queue
+ */
 int _mq_get_csize(str *name) 
 {
 	mq_head_t *mh = mq_head_get(name);

+ 2 - 1
modules/mqueue/mqueue_mod.c

@@ -158,7 +158,8 @@ static int w_mq_size(struct sip_msg *msg, char *mq, char *str2)
 	ret = _mq_get_csize(&q);
 
 	if(ret < 0)
-		LM_ERR("mqueue not found\n");
+		LM_ERR("mqueue %.*s not found\n", q.len, q.s);
+	if(ret<=0) ret--;
 
 	return ret;
 }