Merge pull request #1080 in FS/freeswitch from ~MOCHOUINARD/freeswitch:FS-9788 to master
* commit '347c93f1c1360d7f03d337d4b428cd24ad6d7b16': FS-9788: Add close() option to FileIO implementation
This commit is contained in:
commit
2af53f5a30
|
@ -67,6 +67,7 @@ public:
|
||||||
JS_FILEIO_FUNCTION_DEF(Read);
|
JS_FILEIO_FUNCTION_DEF(Read);
|
||||||
JS_FILEIO_FUNCTION_DEF(Write);
|
JS_FILEIO_FUNCTION_DEF(Write);
|
||||||
JS_FILEIO_FUNCTION_DEF(GetData);
|
JS_FILEIO_FUNCTION_DEF(GetData);
|
||||||
|
JS_FILEIO_FUNCTION_DEF(Close);
|
||||||
JS_FILEIO_GET_PROPERTY_DEF(GetProperty);
|
JS_FILEIO_GET_PROPERTY_DEF(GetProperty);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,17 @@ FSFileIO::~FSFileIO(void)
|
||||||
if (_fd) {
|
if (_fd) {
|
||||||
switch_file_close(_fd);
|
switch_file_close(_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_core_destroy_memory_pool(&_pool);
|
switch_core_destroy_memory_pool(&_pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS_FILEIO_FUNCTION_IMPL(Close)
|
||||||
|
{
|
||||||
|
if (_fd) {
|
||||||
|
switch_file_close(_fd);
|
||||||
|
_fd = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
string FSFileIO::GetJSClassName()
|
string FSFileIO::GetJSClassName()
|
||||||
{
|
{
|
||||||
return js_class_name;
|
return js_class_name;
|
||||||
|
@ -213,6 +221,7 @@ static const js_function_t fileio_proc[] = {
|
||||||
{"read", FSFileIO::Read},
|
{"read", FSFileIO::Read},
|
||||||
{"write", FSFileIO::Write},
|
{"write", FSFileIO::Write},
|
||||||
{"data", FSFileIO::GetData},
|
{"data", FSFileIO::GetData},
|
||||||
|
{"close", FSFileIO::Close},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue