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. */
| 3826 | * CLIENT_TYPE_MASTER -> The client representing our replication master. |
| 3827 | */ |
| 3828 | int 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 | |
| 3838 | int getClientTypeByName(const char *name) { |
| 3839 | if (!strcasecmp(name,"normal")) return CLIENT_TYPE_NORMAL; |
no outgoing calls
no test coverage detected