MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / HandleIntroducersUpdateTimer

Method HandleIntroducersUpdateTimer

libi2pd/SSU2.cpp:1493–1545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1491 }
1492
1493 void SSU2Server::HandleIntroducersUpdateTimer (const boost::system::error_code& ecode, bool v4)
1494 {
1495 if (ecode != boost::asio::error::operation_aborted)
1496 {
1497 // timeout expired
1498 if (v4)
1499 {
1500 if (i2p::context.GetTesting ())
1501 {
1502 // we still don't know if we need introducers
1503 ScheduleIntroducersUpdateTimer ();
1504 return;
1505 }
1506 if (i2p::context.GetStatus () != eRouterStatusFirewalled)
1507 {
1508 // we don't need introducers
1509 i2p::context.ClearSSU2Introducers (true);
1510 m_Introducers.clear ();
1511 return;
1512 }
1513 // we are firewalled
1514 auto addr = i2p::context.GetRouterInfo ().GetSSU2V4Address ();
1515 if (addr && addr->ssu && addr->ssu->introducers.empty ())
1516 i2p::context.SetUnreachable (true, false); // v4
1517
1518 UpdateIntroducers (true);
1519 ScheduleIntroducersUpdateTimer ();
1520 }
1521 else
1522 {
1523 if (i2p::context.GetTestingV6 ())
1524 {
1525 // we still don't know if we need introducers
1526 ScheduleIntroducersUpdateTimerV6 ();
1527 return;
1528 }
1529 if (i2p::context.GetStatusV6 () != eRouterStatusFirewalled)
1530 {
1531 // we don't need introducers
1532 i2p::context.ClearSSU2Introducers (false);
1533 m_IntroducersV6.clear ();
1534 return;
1535 }
1536 // we are firewalled
1537 auto addr = i2p::context.GetRouterInfo ().GetSSU2V6Address ();
1538 if (addr && addr->ssu && addr->ssu->introducers.empty ())
1539 i2p::context.SetUnreachable (false, true); // v6
1540
1541 UpdateIntroducers (false);
1542 ScheduleIntroducersUpdateTimerV6 ();
1543 }
1544 }
1545 }
1546
1547 bool SSU2Server::AEADChaCha20Poly1305Encrypt (const uint8_t * msg, size_t msgLen,
1548 const uint8_t * ad, size_t adLen, const uint8_t * key, const uint8_t * nonce, uint8_t * buf, size_t len)

Callers

nothing calls this directly

Calls 8

GetTestingMethod · 0.80
ClearSSU2IntroducersMethod · 0.80
GetSSU2V4AddressMethod · 0.80
GetTestingV6Method · 0.80
GetStatusV6Method · 0.80
GetSSU2V6AddressMethod · 0.80
GetStatusMethod · 0.45
SetUnreachableMethod · 0.45

Tested by

no test coverage detected