[sr-dev] [kamailio/kamailio] core websocket close event (#2397)

Daniel-Constantin Mierla notifications at github.com
Tue Jul 14 09:38:19 CEST 2020


@miconda commented on this pull request.



> @@ -261,6 +262,24 @@ int wsconn_add(struct receive_info *rcv, unsigned int sub_protocol)
 	return 0;
 }
 
+static void wsconn_run_close_callback(ws_connection_t *wsc)
+{
+	sip_msg_t *fmsg;
+	sr_event_param_t evp = {0};
+	if(faked_msg_init() < 0) {
+		LM_ERR("faked_msg_init() failed\n");
+		return;
+	}
+	fmsg = faked_msg_next();
+	wsc->rcv.proto_reserved1 = wsc->id;
+	fmsg->rcv = wsc->rcv;
+

Changes to fmsg content should be avoided, because the structure content is reused for following execution cycles, and that can also happen in another module.

There is evp.rcv field for the purpose of passing the received info via callback, any reason not using it?

The alternative is to backup fmsg->rcv to a local variable and restore after the sr_event_exec.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2397#pullrequestreview-447861724
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200714/eb646110/attachment.htm>


More information about the sr-dev mailing list