1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
This commit is contained in:
dan 2023-03-03 14:37:11 -08:00
parent 94c6afee8d
commit 6d28d0d78c
4 changed files with 11 additions and 4 deletions

View file

@ -37,6 +37,7 @@ namespace llarp::quic
// - key_update_timer
Path path{local_addr, remote};
path.remote;
log::debug(logcat, "Connecting to {}", remote);
auto conn = std::make_shared<Connection>(*this, ConnectionID::random(), path, tunnel_port);

View file

@ -100,7 +100,7 @@ namespace llarp::quic
void* user_data)
{
std::basic_string_view data{rawdata, rawdatalen};
log::trace(logcat, "Receiving crypto data @ level {} {}", crypto_level, buffer_printer{data});
log::debug(logcat, "Receiving crypto data @ level {} {}", crypto_level, buffer_printer{data});
auto& conn = *static_cast<Connection*>(user_data);
switch (crypto_level)
@ -124,6 +124,7 @@ namespace llarp::quic
return rv;
}
// if i am the server
if (ngtcp2_conn_is_server(conn))
{
if (auto rv = conn.send_magic(NGTCP2_CRYPTO_LEVEL_INITIAL); rv != 0)
@ -143,6 +144,7 @@ namespace llarp::quic
case NGTCP2_CRYPTO_LEVEL_HANDSHAKE:
log::debug(logcat, "Entering case NGTCP2_CRYPTO_LEVEL_HANDSHAKE");
// if i am the client
if (!ngtcp2_conn_is_server(conn))
{
if (auto rv = conn.recv_transport_params(data); rv != 0)

View file

@ -64,13 +64,13 @@ namespace llarp::quic
// debug
log::debug(logcat, "[{},ecn={}]: received {} bytes", pkt.path, pkt.info.ecn, data.size());
handle_packet(pkt);
handle_packet(std::move(pkt));
log::trace(logcat, "Done handling packet");
}
void
Endpoint::handle_packet(const Packet& p)
Endpoint::handle_packet(Packet p)
{
log::trace(logcat, "Handling incoming quic packet: {}", buffer_printer{p.data});
// debug
@ -99,6 +99,10 @@ namespace llarp::quic
else
log::trace(logcat, "CID is primary CID");
log::debug(logcat, "TESTING: LETS SEE IF THIS WORKS");
p.path = Path{p.path.local, connptr->path.remote};
handle_conn_packet(*connptr, p);
}

View file

@ -111,7 +111,7 @@ namespace llarp::quic
// Called to handle an incoming packet
void
handle_packet(const Packet& p);
handle_packet(Packet p);
// Internal method: handles initial common packet decoding, returns the connection ID or nullopt
// if decoding failed.