+12
-3
lines changedFilter options
+12
-3
lines changed Original file line number Diff line number Diff line change
@@ -444,10 +444,19 @@ void CUDTGroup::setOpt(SRT_SOCKOPT optName, const void* optval, int optlen)
444
444
HLOGC(gmlog.Debug, log << "... SPREADING to existing sockets.");
445
445
// This means that there are sockets already, so apply
446
446
// this option on them.
447
-
ScopedLock gg(m_GroupLock);
448
-
for (gli_t gi = m_Group.begin(); gi != m_Group.end(); ++gi)
447
+
std::vector<CUDTSocket*> ps_vec;
448
+
{
449
+
// Do copy to avoid deadlock. CUDT::setOpt() cannot be called directly inside this loop, because
450
+
// CUDT::setOpt() will lock m_ConnectionLock, which should be locked before m_GroupLock.
451
+
ScopedLock gg(m_GroupLock);
452
+
for (gli_t gi = m_Group.begin(); gi != m_Group.end(); ++gi)
453
+
{
454
+
ps_vec.push_back(gi->ps);
455
+
}
456
+
}
457
+
for (std::vector<CUDTSocket*>::iterator it = ps_vec.begin(); it != ps_vec.end(); ++it)
449
458
{
450
-
gi->ps->core().setOpt(optName, optval, optlen);
459
+
(*it)->core().setOpt(optName, optval, optlen);
451
460
}
452
461
}
453
462
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4