| 4850 | #define RTPENGINE_DGRAM_BUF 35536 |
| 4851 | |
| 4852 | static 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 ); |
| 4893 | done: |
| 4894 | return 0; |
| 4895 | err: |
| 4896 | profiling_proc_end( LEVEL_EXTRAPROCS, -1 ); |
| 4897 | return -1; |
| 4898 | } |
| 4899 | |
| 4900 | static void rtpengine_notify_process(int rank) |
| 4901 | { |
nothing calls this directly
no test coverage detected