Browse code

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 authored on 06/07/2009 20:54:52
Showing 1 changed files
... ...
@@ -125,8 +125,11 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
125 125
 
126 126
 	if (msg->first_line.type==SIP_REQUEST){
127 127
 		if (!IS_SIP(msg)){
128
-			if (nonsip_msg_run_hooks(msg)!=NONSIP_MSG_ACCEPT)
128
+			if ((ret=nonsip_msg_run_hooks(msg))!=NONSIP_MSG_ACCEPT){
129
+				if (unlikely(ret==NONSIP_MSG_ERROR))
130
+					goto error03;
129 131
 				goto end; /* drop the message */
132
+			}
130 133
 		}
131 134
 		/* sanity checks */
132 135
 		if ((msg->via1==0) || (msg->via1->error!=PARSE_OK)){
... ...
@@ -257,6 +260,7 @@ error_req:
257 260
 	DBG("receive_msg: error:...\n");
258 261
 	/* execute post request-script callbacks */
259 262
 	exec_post_script_cb(msg, REQUEST_CB_TYPE);
263
+error03:
260 264
 	/* free possible loaded avps -bogdan */
261 265
 	reset_avps();
262 266
 error02: