core: execute SREV_NET_DATA_RECV event
authorDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 11 Jan 2016 21:23:26 +0000 (22:23 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Mon, 11 Jan 2016 21:24:28 +0000 (22:24 +0100)
receive.c

index 8a633cd..a9e1fc3 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -91,6 +91,7 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
        unsigned int diff;
 #endif
        str inb;
+       sr_net_info_t netinfo;
 
        inb.s = buf;
        inb.len = len;
@@ -139,6 +140,14 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
        /* ... clear branches from previous message */
        clear_branches();
 
+       if(sr_event_enabled(SREV_NET_DATA_RECV)) {
+               memset(&netinfo, 0, sizeof(sr_net_info_t));
+               netinfo.data.s = msg->buf;
+               netinfo.data.len = msg->len;
+               netinfo.rcv = rcv_info;
+               sr_event_exec(SREV_NET_DATA_RECV, (void*)&netinfo);
+       }
+
        if (msg->first_line.type==SIP_REQUEST){
                ruri_mark_new(); /* ruri is usable for forking (not consumed yet) */
                if (!IS_SIP(msg)){