[sr-dev] git:master:53529269: core: execute event SREV_NET_DATA_SEND if data was sent to network

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 11 12:43:29 CET 2016


Module: kamailio
Branch: master
Commit: 53529269d88adf140985192cd4ba6e8174fcc231
URL: https://github.com/kamailio/kamailio/commit/53529269d88adf140985192cd4ba6e8174fcc231

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-11T12:40:59+01:00

core: execute event SREV_NET_DATA_SEND if data was sent to network

---

Modified: forward.h

---

Diff:  https://github.com/kamailio/kamailio/commit/53529269d88adf140985192cd4ba6e8174fcc231.diff
Patch: https://github.com/kamailio/kamailio/commit/53529269d88adf140985192cd4ba6e8174fcc231.patch

---

diff --git a/forward.h b/forward.h
index 9c075b8..537d378 100644
--- a/forward.h
+++ b/forward.h
@@ -56,6 +56,11 @@ enum ss_mismatch {
 	SS_MISMATCH_MCAST  /* mcast forced send socket */
 };
 
+typedef struct sr_send_info {
+	str data;
+	struct dest_info* dst;
+} sr_net_info_t;
+
 struct socket_info* get_send_socket2(struct socket_info* force_send_socket,
 									union sockaddr_union* su, int proto,
 									enum ss_mismatch* mismatch);
@@ -119,6 +124,8 @@ static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
 {
 	struct dest_info new_dst;
 	str outb;
+	sr_net_info_t netinfo;
+
 #ifdef USE_TCP 
 	int port;
 	struct ip_addr ip;
@@ -271,6 +278,15 @@ static inline int msg_send_buffer(struct dest_info* dst, char* buf, int len,
 	}
 	ret = 0;
 done:
+
+	if(!(flags&1)) {
+		memset(&netinfo, 0, sizeof(sr_net_info_t));
+		netinfo.data.s = outb.s;
+		netinfo.data.len = outb.len;
+		netinfo.dst = dst;
+		sr_event_exec(SREV_NET_DATA_SEND, (void*)&netinfo);
+	}
+
 	if(outb.s != buf)
 		pkg_free(outb.s);
 	return ret;




More information about the sr-dev mailing list