core: build_req_buf_from_sip_req() has a new parameter
[sip-router] / receive.c
index ac92867..9f59933 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -76,6 +76,13 @@ str default_global_port={0,0};
 str default_via_address={0,0};
 str default_via_port={0,0};
 
+/**
+ * increment msg_no and return the new value
+ */
+unsigned int inc_msg_no(void)
+{
+       return ++msg_no;
+}
 
 
 /* WARNING: buf must be 0 terminated (buf[len]=0) or some things might 
@@ -125,8 +132,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 +267,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: