Separated waiting for message from acting on message.
Necessary refactoring of parameter types propagated through source.
This commit is contained in:
@@ -24,11 +24,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using namespace std;
|
||||
|
||||
shared_ptr<U2F_CMD> U2F_CMD::get(const shared_ptr<U2FMessage> uMsg)
|
||||
shared_ptr<U2F_CMD> U2F_CMD::get(const U2FMessage& uMsg)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (uMsg->cmd)
|
||||
switch (uMsg.cmd)
|
||||
{
|
||||
case U2FHID_PING:
|
||||
return make_shared<U2F_Ping_CMD>(uMsg);
|
||||
@@ -37,13 +37,13 @@ shared_ptr<U2F_CMD> U2F_CMD::get(const shared_ptr<U2FMessage> uMsg)
|
||||
case U2FHID_INIT:
|
||||
return make_shared<U2F_Init_CMD>(uMsg);
|
||||
default:
|
||||
U2FMessage::error(uMsg->cid, ERR_INVALID_CMD);
|
||||
U2FMessage::error(uMsg.cid, ERR_INVALID_CMD);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
catch (runtime_error& ignored)
|
||||
{
|
||||
U2FMessage::error(uMsg->cid, ERR_OTHER);
|
||||
U2FMessage::error(uMsg.cid, ERR_OTHER);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user