mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
[Core] Add PRE_CLOSED flag on file handle, add unit test.
This commit is contained in:
committed by
Andrey Volk
parent
5274dd1f9c
commit
b124b607d7
@@ -1937,7 +1937,8 @@ typedef enum {
|
||||
SWITCH_FILE_NOMUX = (1 << 17),
|
||||
SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18),
|
||||
SWITCH_FILE_FLAG_VIDEO = (1 << 19),
|
||||
SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20)
|
||||
SWITCH_FILE_FLAG_VIDEO_EOF = (1 << 20),
|
||||
SWITCH_FILE_PRE_CLOSED = (1 << 21)
|
||||
} switch_file_flag_enum_t;
|
||||
typedef uint32_t switch_file_flag_t;
|
||||
|
||||
|
||||
@@ -915,6 +915,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_pre_close(switch_file_handle_t
|
||||
}
|
||||
|
||||
switch_clear_flag_locked(fh, SWITCH_FILE_OPEN);
|
||||
switch_set_flag_locked(fh, SWITCH_FILE_PRE_CLOSED);
|
||||
|
||||
if (fh->file_interface->file_pre_close) {
|
||||
status = fh->file_interface->file_pre_close(fh);
|
||||
@@ -929,10 +930,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
|
||||
|
||||
if (switch_test_flag(fh, SWITCH_FILE_OPEN)) {
|
||||
status = switch_core_file_pre_close(fh);
|
||||
} else {
|
||||
} else if (!switch_test_flag(fh, SWITCH_FILE_PRE_CLOSED)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch_clear_flag_locked(fh, SWITCH_FILE_PRE_CLOSED);
|
||||
|
||||
fh->file_interface->file_close(fh);
|
||||
|
||||
if (fh->params) {
|
||||
|
||||
Reference in New Issue
Block a user