mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-15 12:13:24 +00:00
a61e9636b2
if a pending inbound session did not complete a handshake after an unclean close from a previous session the remote udp endpoint would remain stuck mapped as authed and thus any further attempts from the remote would be silently dropped as it entered a stuck state in the state machine. this was happening as a small part of the state machine was hidden in the implementation details of iwp, but instead should be in the super type as it is logic exclusively outside the details which every dialect would have regardless of its details. this commit will unmap the udp endpoint every time it needs to in the link layer state machine, independat of the implementation details of the diact.
64 lines
1.4 KiB
C++
64 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <llarp/constants/link_layer.hpp>
|
|
#include <llarp/crypto/crypto.hpp>
|
|
#include <llarp/crypto/encrypted.hpp>
|
|
#include <llarp/crypto/types.hpp>
|
|
#include <llarp/link/server.hpp>
|
|
#include <llarp/config/key_manager.hpp>
|
|
|
|
#include <memory>
|
|
|
|
#include <llarp/ev/ev.hpp>
|
|
|
|
namespace llarp::iwp
|
|
{
|
|
struct Session;
|
|
|
|
struct LinkLayer final : public ILinkLayer
|
|
{
|
|
LinkLayer(
|
|
std::shared_ptr<KeyManager> keyManager,
|
|
std::shared_ptr<EventLoop> ev,
|
|
GetRCFunc getrc,
|
|
LinkMessageHandler h,
|
|
SignBufferFunc sign,
|
|
BeforeConnectFunc_t before,
|
|
SessionEstablishedHandler est,
|
|
SessionRenegotiateHandler reneg,
|
|
TimeoutHandler timeout,
|
|
SessionClosedHandler closed,
|
|
PumpDoneHandler pumpDone,
|
|
WorkerFunc_t dowork,
|
|
bool permitInbound);
|
|
|
|
std::shared_ptr<ILinkSession>
|
|
NewOutboundSession(const RouterContact& rc, const AddressInfo& ai) override;
|
|
|
|
const char*
|
|
Name() const override;
|
|
|
|
uint16_t
|
|
Rank() const override;
|
|
|
|
void
|
|
RecvFrom(const SockAddr& from, ILinkSession::Packet_t pkt) override;
|
|
|
|
void
|
|
WakeupPlaintext();
|
|
|
|
std::string
|
|
PrintableName() const;
|
|
|
|
private:
|
|
void
|
|
HandleWakeupPlaintext();
|
|
|
|
const std::shared_ptr<EventLoopWakeup> m_Wakeup;
|
|
std::vector<ILinkSession*> m_WakingUp;
|
|
const bool m_Inbound;
|
|
};
|
|
|
|
using LinkLayer_ptr = std::shared_ptr<LinkLayer>;
|
|
} // namespace llarp::iwp
|