MCPcopy Create free account
hub / github.com/F-Stack/f-stack / subscribeCommand

Function subscribeCommand

app/redis-6.2.6/src/pubsub.c:339–356  ·  view source on GitHub ↗

SUBSCRIBE channel [channel ...] */

Source from the content-addressed store, hash-verified

337
338/* SUBSCRIBE channel [channel ...] */
339void subscribeCommand(client *c) {
340 int j;
341 if ((c->flags & CLIENT_DENY_BLOCKING) && !(c->flags & CLIENT_MULTI)) {
342 /**
343 * A client that has CLIENT_DENY_BLOCKING flag on
344 * expect a reply per command and so can not execute subscribe.
345 *
346 * Notice that we have a special treatment for multi because of
347 * backword compatibility
348 */
349 addReplyError(c, "SUBSCRIBE isn't allowed for a DENY BLOCKING client");
350 return;
351 }
352
353 for (j = 1; j < c->argc; j++)
354 pubsubSubscribeChannel(c,c->argv[j]);
355 c->flags |= CLIENT_PUBSUB;
356}
357
358/* UNSUBSCRIBE [channel [channel ...]] */
359void unsubscribeCommand(client *c) {

Callers

nothing calls this directly

Calls 2

addReplyErrorFunction · 0.85
pubsubSubscribeChannelFunction · 0.85

Tested by

no test coverage detected