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

Method set_ctx

lib_acl_cpp/src/stream/stream.cpp:230–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230bool stream::set_ctx(void* ctx, const char* key /* = NULL */,
231 bool replace /* = true */)
232{
233 if (key == NULL || *key == 0) {
234 if (!replace && default_ctx_ != NULL) {
235 return false;
236 }
237 default_ctx_ = ctx;
238 return true;
239 }
240
241 if (ctx_table_ == NULL) {
242 ctx_table_ = NEW std::map<string, void*>;
243 }
244
245 if (replace) {
246 (*ctx_table_)[key] = ctx;
247 return true;
248 }
249
250 std::map<string, void*>::const_iterator cit = ctx_table_->find(key);
251 if (cit != ctx_table_->end()) {
252 return false;
253 }
254 (*ctx_table_)[key] = ctx;
255 return true;
256}
257
258void* stream::get_ctx(const char* key /* = NULL */) const
259{

Callers 15

fiber_clientFunction · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
setup_sslMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45
thread_on_acceptMethod · 0.45

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected