mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine generate_id, never set the cid for current thread
This commit is contained in:
parent
7052a1fafb
commit
bbc168d980
6 changed files with 13 additions and 14 deletions
|
@ -80,21 +80,22 @@ public:
|
|||
// The logic context, for example, a RTMP connection, or RTC Session, etc.
|
||||
// We can grep the context id to identify the logic unit, for debugging.
|
||||
// For example:
|
||||
// _srs_context->generate_id(); // Generate a new context id.
|
||||
// _srs_context->get_id(); // Get current context id.
|
||||
// int old_id = _srs_context->set_id("1000"); // Change the context id.
|
||||
// SrsContextId cid = _srs_context->get_id(); // Get current context id.
|
||||
// SrsContextId new_cid = _srs_context->generate_id(); // Generate a new context id.
|
||||
// SrsContextId old_cid = _srs_context->set_id(new_cid); // Change the context id.
|
||||
class ISrsContext
|
||||
{
|
||||
public:
|
||||
ISrsContext();
|
||||
virtual ~ISrsContext();
|
||||
public:
|
||||
// Generate the id for current context.
|
||||
// Generate a new context id.
|
||||
// @remark We do not set to current thread, user should do this.
|
||||
virtual SrsContextId generate_id() = 0;
|
||||
// Get the generated id of current context.
|
||||
// Get the context id of current thread.
|
||||
virtual SrsContextId get_id() = 0;
|
||||
// Set the id of current context.
|
||||
// @return the previous id value; 0 if no context.
|
||||
// Set the context id of current thread.
|
||||
// @return the previous context id.
|
||||
virtual SrsContextId set_id(SrsContextId v) = 0;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue