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

Function getClientType

src/networking.cpp:3828–3836  ·  view source on GitHub ↗

Get the class of a client, used in order to enforce limits to different * classes of clients. * * The function will return one of the following: * CLIENT_TYPE_NORMAL -> Normal client * CLIENT_TYPE_SLAVE -> Slave * CLIENT_TYPE_PUBSUB -> Client subscribed to Pub/Sub channels * CLIENT_TYPE_MASTER -> The client representing our replication master. */

Source from the content-addressed store, hash-verified

3826 * CLIENT_TYPE_MASTER -> The client representing our replication master.
3827 */
3828int getClientType(client *c) {
3829 if (c->flags & CLIENT_MASTER) return CLIENT_TYPE_MASTER;
3830 /* Even though MONITOR clients are marked as replicas, we
3831 * want the expose them as normal clients. */
3832 if ((c->flags & CLIENT_SLAVE) && !(c->flags & CLIENT_MONITOR))
3833 return CLIENT_TYPE_SLAVE;
3834 if (c->flags & CLIENT_PUBSUB) return CLIENT_TYPE_PUBSUB;
3835 return CLIENT_TYPE_NORMAL;
3836}
3837
3838int getClientTypeByName(const char *name) {
3839 if (!strcasecmp(name,"normal")) return CLIENT_TYPE_NORMAL;

Callers 8

afterErrorReplyFunction · 0.85
freeClientFunction · 0.85
processInlineBufferFunction · 0.85
getAllClientsInfoStringFunction · 0.85
clientCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected