Browse code

evapi:return code and log fixed for no evapi client while sending

Surendra Tiwari authored on 19/07/2019 07:37:32
Showing 1 changed files
... ...
@@ -728,6 +728,7 @@ int _evapi_relay(str *evdata, str *ctag, int unicast)
728 728
 
729 729
 	int len;
730 730
 	int sbsize;
731
+	int evapi_send_count;
731 732
 	evapi_msg_t *emsg;
732 733
 
733 734
 	LM_DBG("relaying event data [%.*s] (%d)\n",
... ...
@@ -781,7 +782,12 @@ int _evapi_relay(str *evdata, str *ctag, int unicast)
781 782
 		cfg_update();
782 783
 		LM_DBG("dispatching [%p] [%.*s] (%d)\n", emsg,
783 784
 				emsg->data.len, emsg->data.s, emsg->data.len);
784
-		evapi_dispatch_notify(emsg);
785
+		evapi_send_count = evapi_dispatch_notify(emsg);
786
+                if (evapi_send_count == 0) {
787
+			shm_free(emsg); 
788
+			LM_ERR("no evapi client to send the message, failed to send message\n");
789
+			return -1; 
790
+		}
785 791
 		shm_free(emsg);
786 792
 	}
787 793
 	return 0;