Retry build_rtpp_socks() if any DNS or create, bind, connect
issues happened when kamailio started, and at least one node
from list was skipped.
This retry will happen automatically, when select_rtpp_node() is called
and will avoid a need for a "kamcmd rtpengine.reload"
... | ... |
@@ -1794,6 +1794,9 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1794 | 1794 |
|
1795 | 1795 |
if(_rtpe_list_vernum_local == _rtpe_list_version->vernum) { |
1796 | 1796 |
/* same version for the list of rtpengines */ |
1797 |
+ LM_DBG("same rtpengines list version: %d (%u)\n", |
|
1798 |
+ _rtpe_list_version->vernum, |
|
1799 |
+ (unsigned int)_rtpe_list_version->vertime); |
|
1797 | 1800 |
return 0; |
1798 | 1801 |
} |
1799 | 1802 |
|
... | ... |
@@ -1840,6 +1843,11 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1840 | 1843 |
if (hostname==NULL) { |
1841 | 1844 |
LM_ERR("no more pkg memory\n"); |
1842 | 1845 |
rtpp_socks[pnode->idx] = -1; |
1846 |
+ |
|
1847 |
+ /* retry later */ |
|
1848 |
+ _rtpe_list_version->vernum += 1; |
|
1849 |
+ _rtpe_list_version->vertime = time(NULL); |
|
1850 |
+ |
|
1843 | 1851 |
continue; |
1844 | 1852 |
} |
1845 | 1853 |
strcpy(hostname, pnode->rn_address); |
... | ... |
@@ -1860,6 +1868,11 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1860 | 1868 |
LM_ERR("%s\n", gai_strerror(n)); |
1861 | 1869 |
pkg_free(hostname); |
1862 | 1870 |
rtpp_socks[pnode->idx] = -1; |
1871 |
+ |
|
1872 |
+ /* retry later */ |
|
1873 |
+ _rtpe_list_version->vernum += 1; |
|
1874 |
+ _rtpe_list_version->vertime = time(NULL); |
|
1875 |
+ |
|
1863 | 1876 |
continue; |
1864 | 1877 |
} |
1865 | 1878 |
pkg_free(hostname); |
... | ... |
@@ -1869,6 +1882,11 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1869 | 1882 |
if (rtpp_socks[pnode->idx] == -1) { |
1870 | 1883 |
LM_ERR("can't create socket\n"); |
1871 | 1884 |
freeaddrinfo(res); |
1885 |
+ |
|
1886 |
+ /* retry later */ |
|
1887 |
+ _rtpe_list_version->vernum += 1; |
|
1888 |
+ _rtpe_list_version->vertime = time(NULL); |
|
1889 |
+ |
|
1872 | 1890 |
continue; |
1873 | 1891 |
} |
1874 | 1892 |
|
... | ... |
@@ -1899,6 +1917,11 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1899 | 1917 |
close(rtpp_socks[pnode->idx]); |
1900 | 1918 |
rtpp_socks[pnode->idx] = -1; |
1901 | 1919 |
freeaddrinfo(res); |
1920 |
+ |
|
1921 |
+ /* retry later */ |
|
1922 |
+ _rtpe_list_version->vernum += 1; |
|
1923 |
+ _rtpe_list_version->vertime = time(NULL); |
|
1924 |
+ |
|
1902 | 1925 |
continue; |
1903 | 1926 |
} |
1904 | 1927 |
|
... | ... |
@@ -1907,6 +1930,11 @@ static int build_rtpp_socks(int lmode, int rtest) { |
1907 | 1930 |
close(rtpp_socks[pnode->idx]); |
1908 | 1931 |
rtpp_socks[pnode->idx] = -1; |
1909 | 1932 |
freeaddrinfo(res); |
1933 |
+ |
|
1934 |
+ /* retry later */ |
|
1935 |
+ _rtpe_list_version->vernum += 1; |
|
1936 |
+ _rtpe_list_version->vertime = time(NULL); |
|
1937 |
+ |
|
1910 | 1938 |
continue; |
1911 | 1939 |
} |
1912 | 1940 |
|