Skip to content

Commit b6f0738

Browse files
committed
[lla] Make sure session is stopped on last release
1 parent c758ff1 commit b6f0738

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/Alf/Lla.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class LlaSession
3232
public:
3333
LlaSession(std::shared_ptr<lla::Session> llaSession);
3434
LlaSession(std::string sessionName, roc::SerialId serialId);
35+
~LlaSession();
3536
void start();
3637
void stop();
3738

src/Lla.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ LlaSession::LlaSession(std::string sessionName, roc::SerialId serialId)
3333
{
3434
}
3535

36+
/* The LlaSession object goes out of scope when the last shared_ptr instance is destroyed (See AlfServer.h).
37+
Since said destruction may follow an erroneous event and the session might not be explicitly stopped
38+
it is forcefully stopped it in the destructor */
39+
LlaSession::~LlaSession()
40+
{
41+
stop();
42+
}
43+
3644
void LlaSession::start()
3745
{
3846
if (!mSession) {

0 commit comments

Comments
 (0)