-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed crash found with non-blocking linger in srt-live-transmit #627
Conversation
…variables. Added some logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix tabs. The rest is approved.
srtcore/api.cpp
Outdated
{ | ||
HLOGC(mglog.Debug, log << "@" << u << "U::close: NOT AN ACTIVE SOCKET, returning."); | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs.
srtcore/api.cpp
Outdated
@@ -1831,11 +1833,13 @@ void* CUDTUnited::garbageCollect(void* p) | |||
timeout.tv_sec = now.tv_sec + 1; | |||
timeout.tv_nsec = now.tv_usec * 1000; | |||
|
|||
HLOGC(mglog.Debug, log << "GC: sleep until " << FormatTime(uint64_t(now.tv_usec) + 1000000*(timeout.tv_sec))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs.
srtcore/api.cpp
Outdated
@@ -964,35 +965,36 @@ int CUDTUnited::close(const SRTSOCKET u) | |||
s->m_TimeStamp = CTimer::getTime(); | |||
|
|||
m_Sockets.erase(s->m_SocketID); | |||
m_ClosedSockets.insert(pair<SRTSOCKET, CUDTSocket*>(s->m_SocketID, s)); | |||
m_ClosedSockets[s->m_SocketID] = s; | |||
HLOGC(mglog.Debug, log << "@" << u << "U::close: Socket MOVED TO CLOSED for collecting later."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs.
The crash observed during closing the program with non-blocking and working linger was due to collision of the global object destruction.
This fix provides fair call of srt_cleanup() at the end, as it should be, and some smaller fixes to avoid possible collisions around global variables in the future.