diff --git a/include/dxfeed_graal_cpp_api/ipf/live/InstrumentProfileConnection.hpp b/include/dxfeed_graal_cpp_api/ipf/live/InstrumentProfileConnection.hpp index f90868e8..5f20498b 100644 --- a/include/dxfeed_graal_cpp_api/ipf/live/InstrumentProfileConnection.hpp +++ b/include/dxfeed_graal_cpp_api/ipf/live/InstrumentProfileConnection.hpp @@ -157,10 +157,16 @@ class DXFCPP_EXPORT InstrumentProfileConnection final : public SharedEntity { /** * Starts this instrument profile connection. This connection's state immediately changes to - * @ref InstrumentProfileConnection::State#CONNECTING "CONNECTING" and the actual connection establishment proceeds + * @ref InstrumentProfileConnection::State::CONNECTING "CONNECTING" and the actual connection establishment proceeds * in the background. */ void start() const noexcept; + + /** + * Closes this instrument profile connection. This connection's state immediately changes to + * @ref InstrumentProfileConnection::State::CLOSED "CLOSED" and the background update procedures are terminated. + */ + void close() const noexcept; }; } // namespace dxfcpp \ No newline at end of file diff --git a/include/dxfeed_graal_cpp_api/isolated/Isolated.hpp b/include/dxfeed_graal_cpp_api/isolated/Isolated.hpp index caf59308..c0918828 100644 --- a/include/dxfeed_graal_cpp_api/isolated/Isolated.hpp +++ b/include/dxfeed_graal_cpp_api/isolated/Isolated.hpp @@ -47,6 +47,7 @@ struct InstrumentProfileConnection { static dxfcpp::InstrumentProfileConnection::State getState(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept; static std::int64_t getLastModified(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept; static bool start(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept; + static bool close(/* dxfg_ipf_connection_t * */ void* instrumentProfileConnectionHandle) noexcept; }; struct InstrumentProfileList { diff --git a/src/internal/Isolate.cpp b/src/internal/Isolate.cpp index 6688a075..0d39f3ec 100644 --- a/src/internal/Isolate.cpp +++ b/src/internal/Isolate.cpp @@ -438,6 +438,20 @@ bool InstrumentProfileConnection::start( false, dxfcpp::bit_cast(instrumentProfileConnectionHandle)); } +bool InstrumentProfileConnection::close( + /* dxfg_ipf_connection_t * */ void *instrumentProfileConnectionHandle) noexcept { + if (!instrumentProfileConnectionHandle) { + return false; + } + + return runIsolatedOrElse( + [](auto threadHandle, auto &&instrumentProfileConnectionHandle) { + return dxfg_InstrumentProfileConnection_close(dxfcpp::bit_cast(threadHandle), + instrumentProfileConnectionHandle) == 0; + }, + false, dxfcpp::bit_cast(instrumentProfileConnectionHandle)); +} + bool InstrumentProfileList::release(/* dxfg_instrument_profile_list * */ void *graalInstrumentProfileList) noexcept { if (!graalInstrumentProfileList) { return false; diff --git a/src/ipf/live/InstrumentProfileConnection.cpp b/src/ipf/live/InstrumentProfileConnection.cpp index 7091e049..0c124132 100644 --- a/src/ipf/live/InstrumentProfileConnection.cpp +++ b/src/ipf/live/InstrumentProfileConnection.cpp @@ -89,4 +89,12 @@ void InstrumentProfileConnection::start() const noexcept { isolated::ipf::InstrumentProfileConnection::start(handle_.get()); } +void InstrumentProfileConnection::close() const noexcept { + if (!handle_) { + return; + } + + isolated::ipf::InstrumentProfileConnection::close(handle_.get()); +} + } // namespace dxfcpp \ No newline at end of file