MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / rtpengine_io_callback

Function rtpengine_io_callback

modules/rtpengine/rtpengine.c:4852–4898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4850#define RTPENGINE_DGRAM_BUF 35536
4851
4852static int rtpengine_io_callback(int fd, void *fs, int was_timeout)
4853{
4854 int ret;
4855 char *p;
4856 char buffer[RTPENGINE_DGRAM_BUF];
4857
4858 profiling_proc_start( LEVEL_EXTRAPROCS, 1);
4859
4860 do
4861 ret = read(fd, buffer, RTPENGINE_DGRAM_BUF);
4862 while (ret == -1 && errno == EINTR);
4863 if (ret < 0) {
4864 LM_ERR("problem reading on socket %s:%u (%s:%d)\n",
4865 rtpengine_notify_sock.s, rtpengine_notify_port, strerror(errno), errno);
4866 goto err;
4867 }
4868
4869 if (!evi_probe_event(rtpengine_notify_event)) {
4870 LM_DBG("nothing to do - nobody is listening!\n");
4871 goto done;
4872 }
4873
4874 p = shm_malloc(ret + 1);
4875 if (!p) {
4876 /* coverity[string_null] - false positive CID #211356 */
4877 LM_ERR("could not allocate %d for buffer %.*s\n", ret, ret, buffer);
4878 goto err;
4879 }
4880 memcpy(p, buffer, ret);
4881 p[ret] = '\0';
4882
4883 profiling_proc_enter( LEVEL_EXTRAPROCS, ss_merge256("RTPE_CB ",p), 0);
4884
4885 LM_INFO("dispatching buffer: %s\n", p);
4886 if (ipc_dispatch_rpc(rtpengine_raise_event, p) < 0) {
4887 LM_ERR("could not dispatch notification job!\n");
4888 shm_free(p);
4889 }
4890
4891 profiling_proc_exit( LEVEL_EXTRAPROCS, "RTPE_CB", 0);
4892 profiling_proc_end( LEVEL_EXTRAPROCS, 0 );
4893done:
4894 return 0;
4895err:
4896 profiling_proc_end( LEVEL_EXTRAPROCS, -1 );
4897 return -1;
4898}
4899
4900static void rtpengine_notify_process(int rank)
4901{

Callers

nothing calls this directly

Calls 7

profiling_proc_startFunction · 0.85
evi_probe_eventFunction · 0.85
shm_mallocFunction · 0.85
ss_merge256Function · 0.85
ipc_dispatch_rpcFunction · 0.85
shm_freeFunction · 0.85
profiling_proc_endFunction · 0.85

Tested by

no test coverage detected