提交 c24dbb29 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi

Minor cleanup

上级 6868bd27
......@@ -10,8 +10,8 @@
/* Static. */
static constexpr size_t CheckerInterval{ 10u }; // In ms.
static std::mutex globalSyncMutex;
static size_t globalInstances = 0;
static std::mutex GlobalSyncMutex;
static size_t GlobalInstances{ 0u };
/* Static methods for usrsctp global callbacks. */
......@@ -65,10 +65,9 @@ void DepUsrSCTP::ClassInit()
MS_DEBUG_TAG(info, "usrsctp");
{
std::lock_guard<std::mutex> lock(globalSyncMutex);
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
if (globalInstances == 0)
if (GlobalInstances == 0)
{
usrsctp_init_nothreads(0, onSendSctpData, sctpDebug);
......@@ -80,19 +79,17 @@ void DepUsrSCTP::ClassInit()
#endif
}
++globalInstances;
}
++GlobalInstances;
}
void DepUsrSCTP::ClassDestroy()
{
MS_TRACE();
{
std::lock_guard<std::mutex> lock(globalSyncMutex);
--globalInstances;
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
--GlobalInstances;
if (globalInstances == 0)
if (GlobalInstances == 0)
{
usrsctp_finish();
......@@ -101,7 +98,6 @@ void DepUsrSCTP::ClassDestroy()
DepUsrSCTP::mapIdSctpAssociation.clear();
}
}
}
void DepUsrSCTP::CreateChecker()
......@@ -126,7 +122,7 @@ uintptr_t DepUsrSCTP::GetNextSctpAssociationId()
{
MS_TRACE();
std::lock_guard<std::mutex> lock(globalSyncMutex);
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
// NOTE: usrsctp_connect() fails with a value of 0.
if (DepUsrSCTP::nextSctpAssociationId == 0u)
......@@ -150,7 +146,7 @@ void DepUsrSCTP::RegisterSctpAssociation(RTC::SctpAssociation* sctpAssociation)
{
MS_TRACE();
std::lock_guard<std::mutex> lock(globalSyncMutex);
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
MS_ASSERT(DepUsrSCTP::checker != nullptr, "Checker not created");
......@@ -170,7 +166,7 @@ void DepUsrSCTP::DeregisterSctpAssociation(RTC::SctpAssociation* sctpAssociation
{
MS_TRACE();
std::lock_guard<std::mutex> lock(globalSyncMutex);
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
MS_ASSERT(DepUsrSCTP::checker != nullptr, "Checker not created");
......@@ -187,7 +183,7 @@ RTC::SctpAssociation* DepUsrSCTP::RetrieveSctpAssociation(uintptr_t id)
{
MS_TRACE();
std::lock_guard<std::mutex> lock(globalSyncMutex);
std::lock_guard<std::mutex> lock(GlobalSyncMutex);
auto it = DepUsrSCTP::mapIdSctpAssociation.find(id);
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论