Browse code

imc: jump over printing error log messages when list commands are ok

- reported by GH #2481

(cherry picked from commit 92cfb5e8d291706889c926892397e663e2d93b05)

Daniel-Constantin Mierla authored on 22/09/2020 17:00:25
Showing 1 changed files
... ...
@@ -942,13 +942,15 @@ int imc_handle_members(struct sip_msg* msg, imc_cmd_t *cmd,
942 942
 	struct imc_uri room;
943 943
 
944 944
 	memset(&room, '\0', sizeof(room));
945
-	if (build_imc_uri(&room, cmd->param[0].s ? cmd->param[0] : dst->parsed.user, &dst->parsed))
946
-		goto error;
945
+	if (build_imc_uri(&room, cmd->param[0].s ? cmd->param[0] : dst->parsed.user,
946
+				&dst->parsed)) {
947
+		goto done;
948
+	}
947 949
 
948 950
 	rm = imc_get_room(&room.parsed.user, &room.parsed.host);
949 951
 	if (rm == NULL || (rm->flags & IMC_ROOM_DELETED)) {
950 952
 		LM_ERR("Room [%.*s] does not exist!\n",	STR_FMT(&room.uri));
951
-		goto error;
953
+		goto done;
952 954
 	}
953 955
 
954 956
 	/* verify if the user is a member of the room */
... ...
@@ -956,7 +958,7 @@ int imc_handle_members(struct sip_msg* msg, imc_cmd_t *cmd,
956 958
 	if (member == NULL) {
957 959
 		LM_ERR("User [%.*s] is not member of room [%.*s]!\n",
958 960
 				STR_FMT(&src->uri), STR_FMT(&rm->uri));
959
-		goto error;
961
+		goto done;
960 962
 	}
961 963
 
962 964
 	p = imc_body_buf;
... ...
@@ -1004,13 +1006,16 @@ int imc_handle_members(struct sip_msg* msg, imc_cmd_t *cmd,
1004 1006
 	body.len = p - body.s;
1005 1007
 
1006 1008
 	LM_DBG("members = '%.*s'\n", STR_FMT(&body));
1007
-	LM_ERR("Message-ID: '%.*s'\n", STR_FMT(get_callid(msg)));
1009
+	LM_DBG("Message-ID: '%.*s'\n", STR_FMT(get_callid(msg)));
1008 1010
 	imc_send_message(&rm->uri, &member->uri, build_headers(msg), &body);
1009 1011
 
1010 1012
 	rv = 0;
1013
+	goto done;
1014
+
1011 1015
 overrun:
1012 1016
 	LM_ERR("Buffer too small for member list message\n");
1013
-error:
1017
+
1018
+done:
1014 1019
 	if (room.uri.s != NULL) pkg_free(room.uri.s);
1015 1020
 	if (rm != NULL) imc_release_room(rm);
1016 1021
 	return rv;
... ...
@@ -1065,7 +1070,8 @@ int imc_handle_rooms(struct sip_msg* msg, imc_cmd_t *cmd,
1065 1070
 	LM_DBG("rooms = '%.*s'\n", STR_FMT(&body));
1066 1071
 	imc_send_message(&dst->uri, &src->uri, build_headers(msg), &body);
1067 1072
 
1068
-	rv = 0;
1073
+	return 0;
1074
+
1069 1075
 error:
1070 1076
 	LM_ERR("Buffer too small for member list message\n");
1071 1077
 	return rv;