MCPcopy Create free account
hub / github.com/acl-dev/acl / set_client_addr

Method set_client_addr

lib_acl_cpp/src/redis/redis_command.cpp:173–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void redis_command::set_client_addr(redis_client& conn)
174{
175 socket_stream* stream = conn.get_stream();
176 if (stream == NULL) {
177 addr_[0] = 0;
178 return;
179 }
180
181 char buf[128];
182 safe_snprintf(buf, sizeof(buf), "%s", stream->get_peer(true));
183 char* sep = strrchr(buf, '|');
184 if (sep && *(sep + 1)) {
185 *sep++ = 0;
186 safe_snprintf(addr_, sizeof(addr_), "%s:%s", buf, sep);
187 } else {
188 ACL_SAFE_STRNCPY(addr_, stream->get_peer(true), sizeof(addr_));
189 }
190}
191
192void redis_command::set_client_addr(const char* addr)
193{

Callers 5

reopenMethod · 0.80
moveMethod · 0.80
askMethod · 0.80
cluster_downMethod · 0.80
runMethod · 0.80

Calls 3

safe_snprintfFunction · 0.85
get_streamMethod · 0.45
get_peerMethod · 0.45

Tested by

no test coverage detected