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

Function subscribeCommand

src/pubsub.cpp:357–375  ·  view source on GitHub ↗

SUBSCRIBE channel [channel ...] */

Source from the content-addressed store, hash-verified

355
356/* SUBSCRIBE channel [channel ...] */
357void subscribeCommand(client *c) {
358 int j;
359 serverAssert(GlobalLocksAcquired());
360 if ((c->flags & CLIENT_DENY_BLOCKING) && !(c->flags & CLIENT_MULTI)) {
361 /**
362 * A client that has CLIENT_DENY_BLOCKING flag on
363 * expect a reply per command and so can not execute subscribe.
364 *
365 * Notice that we have a special treatment for multi because of
366 * backword compatibility
367 */
368 addReplyError(c, "SUBSCRIBE isn't allowed for a DENY BLOCKING client");
369 return;
370 }
371
372 for (j = 1; j < c->argc; j++)
373 pubsubSubscribeChannel(c,c->argv[j]);
374 c->flags |= CLIENT_PUBSUB;
375}
376
377/* UNSUBSCRIBE [channel [channel ...]] */
378void unsubscribeCommand(client *c) {

Callers

nothing calls this directly

Calls 3

GlobalLocksAcquiredFunction · 0.85
addReplyErrorFunction · 0.85
pubsubSubscribeChannelFunction · 0.85

Tested by

no test coverage detected