mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Refine is_alive code
This commit is contained in:
parent
aeca278de0
commit
4bcfce7ff1
2 changed files with 8 additions and 2 deletions
|
@ -2199,7 +2199,7 @@ srs_error_t SrsRtcConnection::start_publish(std::string stream_uri)
|
|||
|
||||
bool SrsRtcConnection::is_alive()
|
||||
{
|
||||
return last_stun_time + session_timeout < srs_get_system_time();
|
||||
return last_stun_time + session_timeout > srs_get_system_time();
|
||||
}
|
||||
|
||||
void SrsRtcConnection::alive()
|
||||
|
|
|
@ -603,7 +603,13 @@ srs_error_t SrsRtcServer::notify(int type, srs_utime_t interval, srs_utime_t tic
|
|||
// Check all sessions and dispose the dead sessions.
|
||||
for (int i = 0; i < (int)_srs_rtc_manager->size(); i++) {
|
||||
SrsRtcConnection* session = dynamic_cast<SrsRtcConnection*>(_srs_rtc_manager->at(i));
|
||||
if (!session || !session->is_alive() || session->disposing_) {
|
||||
// Ignore not session, or already disposing.
|
||||
if (!session || session->disposing_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Update stat if session is alive.
|
||||
if (session->is_alive()) {
|
||||
nn_rtc_conns++;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue