This function is used for loading the sentinel configuration from * pre_monitor_cfg, monitor_cfg and post_monitor_cfg list */
| 1840 | /* This function is used for loading the sentinel configuration from |
| 1841 | * pre_monitor_cfg, monitor_cfg and post_monitor_cfg list */ |
| 1842 | void loadSentinelConfigFromQueue(void) { |
| 1843 | const char *err = NULL; |
| 1844 | listIter li; |
| 1845 | listNode *ln; |
| 1846 | int linenum = 0; |
| 1847 | sds line = NULL; |
| 1848 | |
| 1849 | /* if there is no sentinel_config entry, we can return immediately */ |
| 1850 | if (server.sentinel_config == NULL) return; |
| 1851 | |
| 1852 | /* loading from pre monitor config queue first to avoid dependency issues */ |
| 1853 | listRewind(server.sentinel_config->pre_monitor_cfg,&li); |
| 1854 | while((ln = listNext(&li))) { |
| 1855 | struct sentinelLoadQueueEntry *entry = ln->value; |
| 1856 | err = sentinelHandleConfiguration(entry->argv,entry->argc); |
| 1857 | if (err) { |
| 1858 | linenum = entry->linenum; |
| 1859 | line = entry->line; |
| 1860 | goto loaderr; |
| 1861 | } |
| 1862 | } |
| 1863 | |
| 1864 | /* loading from monitor config queue */ |
| 1865 | listRewind(server.sentinel_config->monitor_cfg,&li); |
| 1866 | while((ln = listNext(&li))) { |
| 1867 | struct sentinelLoadQueueEntry *entry = ln->value; |
| 1868 | err = sentinelHandleConfiguration(entry->argv,entry->argc); |
| 1869 | if (err) { |
| 1870 | linenum = entry->linenum; |
| 1871 | line = entry->line; |
| 1872 | goto loaderr; |
| 1873 | } |
| 1874 | } |
| 1875 | |
| 1876 | /* loading from the post monitor config queue */ |
| 1877 | listRewind(server.sentinel_config->post_monitor_cfg,&li); |
| 1878 | while((ln = listNext(&li))) { |
| 1879 | struct sentinelLoadQueueEntry *entry = ln->value; |
| 1880 | err = sentinelHandleConfiguration(entry->argv,entry->argc); |
| 1881 | if (err) { |
| 1882 | linenum = entry->linenum; |
| 1883 | line = entry->line; |
| 1884 | goto loaderr; |
| 1885 | } |
| 1886 | } |
| 1887 | |
| 1888 | /* free sentinel_config when config loading is finished */ |
| 1889 | freeSentinelConfig(); |
| 1890 | return; |
| 1891 | |
| 1892 | loaderr: |
| 1893 | fprintf(stderr, "\n*** FATAL CONFIG FILE ERROR (Redis %s) ***\n", |
| 1894 | REDIS_VERSION); |
| 1895 | fprintf(stderr, "Reading the configuration file, at line %d\n", linenum); |
| 1896 | fprintf(stderr, ">>> '%s'\n", line); |
| 1897 | fprintf(stderr, "%s\n", err); |
| 1898 | exit(1); |
| 1899 | } |
no test coverage detected