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

Function psubscribeCommand

src/pubsub.cpp:391–409  ·  view source on GitHub ↗

PSUBSCRIBE pattern [pattern ...] */

Source from the content-addressed store, hash-verified

389
390/* PSUBSCRIBE pattern [pattern ...] */
391void psubscribeCommand(client *c) {
392 int j;
393 serverAssert(GlobalLocksAcquired());
394 if ((c->flags & CLIENT_DENY_BLOCKING) && !(c->flags & CLIENT_MULTI)) {
395 /**
396 * A client that has CLIENT_DENY_BLOCKING flag on
397 * expect a reply per command and so can not execute subscribe.
398 *
399 * Notice that we have a special treatment for multi because of
400 * backword compatibility
401 */
402 addReplyError(c, "PSUBSCRIBE isn't allowed for a DENY BLOCKING client");
403 return;
404 }
405
406 for (j = 1; j < c->argc; j++)
407 pubsubSubscribePattern(c,c->argv[j]);
408 c->flags |= CLIENT_PUBSUB;
409}
410
411/* PUNSUBSCRIBE [pattern [pattern ...]] */
412void punsubscribeCommand(client *c) {

Callers

nothing calls this directly

Calls 3

GlobalLocksAcquiredFunction · 0.85
addReplyErrorFunction · 0.85
pubsubSubscribePatternFunction · 0.85

Tested by

no test coverage detected