switch_thread_rwlock_t *rwlock;
int ready;
int stopped;
- int stop_request;
int part_reload;
int full_reload;
int chime_freq;
switch_yield(1000000);
- while (RUNNING) {
+ while (RUNNING && !source->stopped) {
switch_size_t olen;
uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
goto done;
}
- while (RUNNING) {
+ while (RUNNING && !source->stopped) {
int is_open;
switch_file_handle_t *use_fh = &fh;
switch_dir_close(source->dir_handle);
source->dir_handle = NULL;
- if(source->stop_request||source->full_reload) {
+ if (source->full_reload) {
if (source->rwlock && switch_thread_rwlock_trywrlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot stop local_stream://%s because it is in use.\n",source->name);
if (source->part_reload) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "local_stream://%s partially reloaded.\n",source->name);
source->part_reload = 0;
}
- } else if(source->stop_request) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "local_stream://%s stopped.\n",source->name);
- source->stopped = 1;
- goto done;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "local_stream://%s fully reloaded.\n",source->name);
launch_streams(source->name);
goto done;
}
- source->stop_request = 1;
+ source->stopped = 1;
stream->write_function(stream, "+OK");
goto done;
stream->write_function(stream, " total: %d\n", source->total);
stream->write_function(stream, " shuffle: %s\n", (source->shuffle) ? "true" : "false");
stream->write_function(stream, " ready: %s\n", (source->ready) ? "true" : "false");
- stream->write_function(stream, " stopping: %s\n", (source->stop_request) ? "true" : "false");
+ stream->write_function(stream, " stopped: %s\n", (source->stopped) ? "true" : "false");
stream->write_function(stream, " reloading: %s\n", (source->full_reload) ? "true" : "false");
}
} else {
switch_mutex_unlock(globals.mutex);
if (source) {
source->stopped = 0;
- source->stop_request = 0;
stream->write_function(stream, "+OK stream: %s", source->name);
goto done;
}