MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / rewriteConfigBindOption

Function rewriteConfigBindOption

src/config.cpp:1783–1802  ·  view source on GitHub ↗

Rewrite the bind option. */

Source from the content-addressed store, hash-verified

1781
1782/* Rewrite the bind option. */
1783void rewriteConfigBindOption(struct rewriteConfigState *state) {
1784 int force = 1;
1785 sds line, addresses;
1786 const char *option = "bind";
1787
1788 /* Nothing to rewrite if we don't have bind addresses. */
1789 if (g_pserver->bindaddr_count == 0) {
1790 rewriteConfigMarkAsProcessed(state,option);
1791 return;
1792 }
1793
1794 /* Rewrite as bind <addr1> <addr2> ... <addrN> */
1795 addresses = sdsjoin(g_pserver->bindaddr,g_pserver->bindaddr_count," ");
1796 line = sdsnew(option);
1797 line = sdscatlen(line, " ", 1);
1798 line = sdscatsds(line, addresses);
1799 sdsfree(addresses);
1800
1801 rewriteConfigRewriteLine(state,option,line,force);
1802}
1803
1804/* Glue together the configuration lines in the current configuration
1805 * rewrite state into a single string, stripping multiple empty lines. */

Callers 1

rewriteConfigFunction · 0.85

Calls 7

sdsjoinFunction · 0.85
sdsnewFunction · 0.85
sdscatlenFunction · 0.85
sdscatsdsFunction · 0.85
sdsfreeFunction · 0.85
rewriteConfigRewriteLineFunction · 0.85

Tested by

no test coverage detected