Переглянути джерело

core: error handling for non-sip hooks

receive_msg will exit with error if a non-sip msg hook returns
NONSIP_MSG_ERROR.
Andrei Pelinescu-Onciul 16 роки тому
батько
коміт
471589c5c0
1 змінених файлів з 5 додано та 1 видалено
  1. 5 1
      receive.c

+ 5 - 1
receive.c

@@ -125,8 +125,11 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
 
 	if (msg->first_line.type==SIP_REQUEST){
 		if (!IS_SIP(msg)){
-			if (nonsip_msg_run_hooks(msg)!=NONSIP_MSG_ACCEPT)
+			if ((ret=nonsip_msg_run_hooks(msg))!=NONSIP_MSG_ACCEPT){
+				if (unlikely(ret==NONSIP_MSG_ERROR))
+					goto error03;
 				goto end; /* drop the message */
+			}
 		}
 		/* sanity checks */
 		if ((msg->via1==0) || (msg->via1->error!=PARSE_OK)){
@@ -257,6 +260,7 @@ error_req:
 	DBG("receive_msg: error:...\n");
 	/* execute post request-script callbacks */
 	exec_post_script_cb(msg, REQUEST_CB_TYPE);
+error03:
 	/* free possible loaded avps -bogdan */
 	reset_avps();
 error02: