Skip to content

Commit

Permalink
Fix connexion not closed when transmit fails
Browse files Browse the repository at this point in the history
rzaiti committed Aug 20, 2024
1 parent 2b52341 commit 61da66c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion weaver/libese_weaver/transport/OmapiTransport.cpp
Original file line number Diff line number Diff line change
@@ -180,7 +180,12 @@ bool OmapiTransport::sendData(const vector<uint8_t>& inData, vector<uint8_t>& ou

if (eSEReader != nullptr) {
LOG(DEBUG) << "Sending apdu data to secure element: " << ESE_READER_PREFIX;
return internalProtectedTransmitApdu(eSEReader, apdu, output);
if (!internalProtectedTransmitApdu(eSEReader, apdu, output))
{
closeConnection();
return false;
} else
return true;
} else {
LOG(ERROR) << "secure element reader " << ESE_READER_PREFIX << " not found";
return false;
@@ -201,6 +206,8 @@ bool OmapiTransport::closeConnection() {
}
omapiSeService = nullptr;
eSEReader = nullptr;
channel = nullptr;
session = nullptr;
return true;
}

0 comments on commit 61da66c

Please sign in to comment.