MCPcopy Create free account
hub / github.com/acl-dev/acl / subop_result

Method subop_result

lib_acl_cpp/src/redis/redis_pubsub.cpp:160–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160int redis_pubsub::subop_result(const char* cmd,
161 const std::vector<const char*>& channels)
162{
163 int nchannels = 0, ret;
164 size_t i = 0;
165 do {
166 const redis_result* res = run();
167 if (res == NULL || res->get_type() != REDIS_RESULT_ARRAY) {
168 return -1;
169 }
170
171 // clear request, so in next loop we just read the data from
172 // redis-server that the data maybe the message to be skipped
173 clear_request();
174
175 const redis_result* o = res->get_child(0);
176 if (o == NULL || o->get_type() != REDIS_RESULT_STRING) {
177 return -1;
178 }
179
180 string tmp;
181 o->argv_to_string(tmp);
182 // just skip message in subscribe process
183 if (tmp.equal("message", false) || tmp.equal("pmessage", false)) {
184 continue;
185 }
186
187 if ((ret = check_channel(res, cmd, channels[i])) < 0) {
188 return -1;
189 }
190
191 if (ret > nchannels) {
192 nchannels = ret;
193 }
194
195 i++;
196
197 } while (i < channels.size());
198
199 return nchannels;
200}
201
202int redis_pubsub::subop(const char* cmd, const std::vector<const char*>& channels)
203{

Callers

nothing calls this directly

Calls 6

equalMethod · 0.80
runFunction · 0.50
get_typeMethod · 0.45
get_childMethod · 0.45
argv_to_stringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected