SUBSCRIBE channel [channel ...] */
| 355 | |
| 356 | /* SUBSCRIBE channel [channel ...] */ |
| 357 | void 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 ...]] */ |
| 378 | void unsubscribeCommand(client *c) { |
nothing calls this directly
no test coverage detected