1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Log: Refine log context, use const

This commit is contained in:
winlin 2020-07-13 11:19:34 +08:00
parent 254529d946
commit 0a057a0427
4 changed files with 16 additions and 16 deletions

View file

@ -49,22 +49,22 @@ SrsContextId SrsThreadContext::generate_id()
return cid;
}
SrsContextId SrsThreadContext::get_id()
const SrsContextId& SrsThreadContext::get_id()
{
return cache[srs_thread_self()];
}
SrsContextId SrsThreadContext::set_id(SrsContextId v)
const SrsContextId& SrsThreadContext::set_id(const SrsContextId& v)
{
srs_thread_t self = srs_thread_self();
SrsContextId ov;
if (cache.find(self) != cache.end()) {
ov = cache[self];
if (cache.find(self) == cache.end()) {
cache[self] = v;
return v;
}
const SrsContextId& ov = cache[self];
cache[self] = v;
return ov;
}

View file

@ -43,8 +43,8 @@ public:
virtual ~SrsThreadContext();
public:
virtual SrsContextId generate_id();
virtual SrsContextId get_id();
virtual SrsContextId set_id(SrsContextId v);
virtual const SrsContextId& get_id();
virtual const SrsContextId& set_id(const SrsContextId& v);
public:
virtual void clear_cid();
};