| 1866 | } |
| 1867 | |
| 1868 | static int connect_rtpengines(int force_test) |
| 1869 | { |
| 1870 | int i; |
| 1871 | struct rtpe_set *rtpe_list; |
| 1872 | struct rtpe_node *pnode; |
| 1873 | |
| 1874 | LM_DBG("[RTPEngine] set list %p\n", *rtpe_set_list); |
| 1875 | if(!(*rtpe_set_list) ) |
| 1876 | return 0; |
| 1877 | LM_DBG("[Re]connecting sockets (%d > %d)\n", *rtpe_no, rtpe_number); |
| 1878 | |
| 1879 | if (*rtpe_no > rtpe_number) { |
| 1880 | rtpe_socks = (int*)pkg_realloc(rtpe_socks, *rtpe_no * sizeof(int)); |
| 1881 | if (rtpe_socks==NULL) { |
| 1882 | LM_ERR("no more pkg memory\n"); |
| 1883 | return -1; |
| 1884 | } |
| 1885 | for (i=rtpe_number; i<*rtpe_no; i++) |
| 1886 | rtpe_socks[i] = -1; /* init new elems */ |
| 1887 | } |
| 1888 | rtpe_number = *rtpe_no; |
| 1889 | |
| 1890 | for(rtpe_list = (*rtpe_set_list)->rset_first; rtpe_list != 0; |
| 1891 | rtpe_list = rtpe_list->rset_next){ |
| 1892 | |
| 1893 | for (pnode=rtpe_list->rn_first; pnode!=0; pnode = pnode->rn_next){ |
| 1894 | /* reuse socket if already initialized */ |
| 1895 | if ((rtpe_socks[pnode->idx] != -1 || rtpengine_connect_node(pnode)) && force_test) |
| 1896 | pnode->rn_disabled = rtpe_test(pnode, 0, 1); |
| 1897 | /* else, there is an error, and we try to connect the next one */ |
| 1898 | } |
| 1899 | } |
| 1900 | |
| 1901 | LM_DBG("successfully updated rtpengine sets\n"); |
| 1902 | return 0; |
| 1903 | } |
| 1904 | |
| 1905 | static int child_init(int rank) |
| 1906 | { |
no test coverage detected