Separated waiting for message from acting on message.

Necessary refactoring of parameter types propagated through source.
This commit is contained in:
2019-08-21 15:55:33 +01:00
parent 2f8e417d00
commit 2987cbe26e
12 changed files with 51 additions and 45 deletions

View File

@@ -33,11 +33,11 @@ uint32_t Channel::getCID() const
return cid;
}
void Channel::handle(const shared_ptr<U2FMessage> uMsg)
void Channel::handle(const U2FMessage& uMsg)
{
if (uMsg->cmd == U2FHID_INIT)
if (uMsg.cmd == U2FHID_INIT)
this->initState = ChannelInitState::Initialised;
else if (uMsg->cid != this->cid)
else if (uMsg.cid != this->cid)
throw runtime_error{ "CID of request invalid for this channel" };
if (this->initState != ChannelInitState::Initialised)