///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| 1269 | |
| 1270 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1271 | void FSecure::C3::Core::Profiler::Gateway::ConditionalUpdateChannelParameters(RouteId connectionPlace) |
| 1272 | { |
| 1273 | try |
| 1274 | { |
| 1275 | // parent is known |
| 1276 | Relay* parent = connectionPlace.GetAgentId() == m_Id ? static_cast<Relay*>(this) : m_Agents.Find(connectionPlace.GetAgentId()); |
| 1277 | if (!parent) |
| 1278 | return; |
| 1279 | |
| 1280 | auto parentChannel = parent->m_Channels.Find(connectionPlace.GetInterfaceId()); |
| 1281 | if (!parentChannel || parentChannel->m_StartupArguments.is_null()) |
| 1282 | return; |
| 1283 | |
| 1284 | Agent* agent = FindNeighborOnDevice(*parent, connectionPlace.GetInterfaceId()); |
| 1285 | auto agentChannel = agent->FindGrc(); |
| 1286 | if (!agentChannel) |
| 1287 | return; |
| 1288 | |
| 1289 | // Channel does not have startup arguments. |
| 1290 | if (!agentChannel->m_StartupArguments.is_null()) |
| 1291 | return; |
| 1292 | |
| 1293 | // build started with neg channel |
| 1294 | auto buildIterator = m_AgentBuilds.find(agent->m_BuildId); |
| 1295 | if (buildIterator == m_AgentBuilds.end() || buildIterator->second.m_StartupCmd["command"].get<std::string>().find("AddNegotiationChannel") == std::string::npos) |
| 1296 | return; |
| 1297 | |
| 1298 | |
| 1299 | // update |
| 1300 | json startupArguments = { {"arguments", json::array()} }; |
| 1301 | startupArguments["arguments"][0][0] = parentChannel->m_StartupArguments["arguments"][0][1]; |
| 1302 | startupArguments["arguments"][0][1] = parentChannel->m_StartupArguments["arguments"][0][0]; |
| 1303 | for (auto i = 1u; i < buildIterator->second.m_StartupCmd["arguments"].size(); ++i) |
| 1304 | startupArguments["arguments"][i] = buildIterator->second.m_StartupCmd["arguments"][i]; |
| 1305 | |
| 1306 | agentChannel->m_StartupArguments = startupArguments; |
| 1307 | } |
| 1308 | catch (const std::exception&) |
| 1309 | { |
| 1310 | return; |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1315 | void FSecure::C3::Core::Profiler::Gateway::Reset() |
no test coverage detected