FS-3882, FS-3546, FS-3712, FS-3970: --resolve Fixes the segfault in mod_rtmp where the channel was destroyed, but the endpoint still tried to send or receive data from the session.

This commit is contained in:
William King 2013-01-15 13:22:28 -08:00
parent 9b33675545
commit 79069c66d1
2 changed files with 7 additions and 0 deletions

View File

@ -250,6 +250,7 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session)
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
switch_thread_rwlock_wrlock(tech_pvt->rtmp_session->rwlock);
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
//switch_thread_cond_signal(tech_pvt->cond);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
@ -286,6 +287,8 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session)
}
#endif
switch_thread_rwlock_unlock(tech_pvt->rtmp_session->rwlock);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -906,10 +906,12 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
rtmp_handle_invoke(rsession, rsession->amfnumber);
break;
case RTMP_TYPE_AUDIO: /* Audio data */
switch_thread_rwlock_wrlock(rsession->rwlock);
if (rsession->tech_pvt) {
uint16_t len = state->origlen;
if (!rsession->tech_pvt->readbuf) {
switch_thread_rwlock_unlock(rsession->rwlock);
return SWITCH_STATUS_FALSE;
}
@ -936,6 +938,8 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
}
switch_mutex_unlock(rsession->tech_pvt->readbuf_mutex);
}
switch_thread_rwlock_unlock(rsession->rwlock);
break;
case RTMP_TYPE_VIDEO: /* Video data */
case RTMP_TYPE_METADATA: /* Metadata */