///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| 44 | |
| 45 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 46 | void FSecure::C3::Core::NodeRelay::OnProtocolS2G(ByteView packet0, std::shared_ptr<DeviceBridge> sender) |
| 47 | { |
| 48 | auto grc = GetGatewayReturnChannel(); |
| 49 | if (!grc) |
| 50 | std::runtime_error{ OBF("No GRC.") }; |
| 51 | |
| 52 | if (grc == sender) |
| 53 | throw std::runtime_error{ OBF("S2G packet received from GRC.") }; |
| 54 | |
| 55 | // Expensive search on NodeRelay. |
| 56 | if (sender->IsChannel() && !FindRouteByOutgoingChannel(sender->GetDid())) |
| 57 | throw std::runtime_error{ OBF("S2G packet received from device that has no route attached.") }; |
| 58 | |
| 59 | LockAndSendPacket(packet0, grc); |
| 60 | } |
| 61 | |
| 62 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 63 | void FSecure::C3::Core::NodeRelay::OnProtocolG2A(ByteView packet0, std::shared_ptr<DeviceBridge> sender) |