result_t Redis::unsub(Buffer_base *channel) { std::string key; channel->toString(key); return unsub(key, UNSUBSCRIBE); }
bool PubSubClient::unsubscribe(String topic) { if (!connected()) return false; MQTT::Unsubscribe unsub(topic); return unsubscribe(unsub); }
void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_, void *arg_) { xpub_t *self = (xpub_t*) arg_; if (self->options.type != ZMQ_PUB) { // Place the unsubscription to the queue of pending (un)sunscriptions // to be retrived by the user later on. blob_t unsub (size_ + 1, 0); unsub [0] = 0; memcpy (&unsub [1], data_, size_); self->pending.push_back (unsub); } }
void handle() { if (!sending && !to_emit.empty()) { sending = true; out = to_emit.back(); to_emit.pop(); out_pos = 0; } if (sending) { send(); return; } if (!cmd_ready) { read_cmd(); } if (cmd_ready) { std::cerr << "\t\t\t\tcmd == " << cmd << std::endl; int cmd_len = cmd_pos - 1; if (strncmp(cmd, LIST, LIST_LEN) == 0) { std::cerr << "\tcmd == list" << std::endl; sending = true; out = list; out_pos = 0; cmd_len = LIST_LEN; } else if (strncmp(cmd, SUB, SUB_LEN) == 0) { std::cerr << "\tcmd == sub" << std::endl; int cnt = sub(); cmd_len = SUB_LEN + cnt; } else if (strncmp(cmd, UNSUB, UNSUB_LEN) == 0) { std::cerr << "\tcmd == unsub" << std::endl; int cnt = unsub(); cmd_len = UNSUB_LEN + cnt; } else if (strncmp(cmd, EMIT, EMIT_LEN) == 0) { std::cerr << "\tcmd == emit" << std::endl; int cnt = emit(); cmd_len = EMIT_LEN + cnt; } memmove(cmd, cmd + cmd_len + 1, cmd_pos - cmd_len - 1); cmd_pos -= cmd_len + 1; cmd_ready = false; } }
void zmq::xpub_t::send_unsubscription (zmq::mtrie_t::prefix_t data_, size_t size_, xpub_t *self_) { if (self_->options.type != ZMQ_PUB) { // Place the unsubscription to the queue of pending (un)subscriptions // to be retrieved by the user later on. blob_t unsub (size_ + 1); *unsub.data () = 0; if (size_ > 0) memcpy (unsub.data () + 1, data_, size_); self_->pending_data.ZMQ_PUSH_OR_EMPLACE_BACK (ZMQ_MOVE (unsub)); self_->pending_metadata.push_back (NULL); self_->pending_flags.push_back (0); if (self_->manual) { self_->last_pipe = NULL; self_->pending_pipes.push_back (NULL); } } }
void zmq::xpub_t::send_unsubscription (unsigned char *data_, size_t size_, void *arg_) { xpub_t *self = (xpub_t*) arg_; if (self->options.type != ZMQ_PUB) { // Place the unsubscription to the queue of pending (un)subscriptions // to be retrieved by the user later on. blob_t unsub (size_ + 1, 0); unsub [0] = 0; if (size_ > 0) memcpy (&unsub [1], data_, size_); self->pending_data.push_back (unsub); self->pending_metadata.push_back (NULL); self->pending_flags.push_back (0); if (self->manual) { self->last_pipe = NULL; self->pending_pipes.push_back (NULL); } } }
result_t Redis::unpsub(v8::Local<v8::Array> patterns) { return unsub(patterns, PUNSUBSCRIBE); }
result_t Redis::unsub(v8::Local<v8::Array> channels) { return unsub(channels, UNSUBSCRIBE); }
result_t Redis::unpsub(const char *pattern) { return unsub(pattern, PUNSUBSCRIBE); }