Code Monkey home page Code Monkey logo

Comments (3)

zoff99 avatar zoff99 commented on August 16, 2024

if (dht_non_lan_connected(dht)) {

also because of this line we would bootstrap endlessly when only connected to LAN nodes?

from c-toxcore.

zoff99 avatar zoff99 commented on August 16, 2024

some one already changed it here for some reason:

// if (dht_non_lan_connected(onion_c->dht)) {
if (dht_isconnected(onion_c->dht)) {

Use TCP paths when UDP is not connected. Made some code depend less on the UDP only DHT.
450ad2d

from c-toxcore.

nurupo avatar nurupo commented on August 16, 2024

you can never reach self UDP connection status.
but friends will get UDP connection status.

The connection status of this instance and the connection status of friends mean different things, which is mentioned in the API documentation, so this case is not surprising:

c-toxcore/toxcore/tox.h

Lines 1021 to 1029 in 172f279

/**
* @brief A UDP connection has been established.
*
* For the own instance, this means it is able to send UDP packets to DHT
* nodes, but may still be connected to a TCP relay. For a friend, this
* means that the connection to that particular friend was built using
* direct UDP packets.
*/
TOX_CONNECTION_UDP,

Looking at the code bits you quoted, it looks like Tox (via the Onion module) considers the case when DHT is connected only to LAN nodes, or no nodes at all, as Tox not being connected to the DHT via UDP. To rephrase this, Tox is connected via UDP only if its DHT is connected to a non-LAN, i.e. Internet, node. This is not a bad assumption in the context of trying to connect to the greater DHT that is on the Internet, as perhaps the router NAT is preventing you from establishing UDP connections with Internet nodes, which is why you are only able to connect to LAN nodes. It's reasonable to say that you are not connected to the DHT via UDP in this case. However, if your intent was never to connect to the Internet DHT, if it was to use Tox on LAN instead, then yes, reporting that DHT is not UDP-connected is misleading. It is not UDP-connected to Internet nodes, but is UDP-connected to LAN nodes. I wonder if we need an extra flag in the connection status to indicate LAN/non-LAN connection status? Or at the very least we could clarify the documentation to say something like "A UDP connection to a non-LAN Internet node has been established.".

also because of this line we would bootstrap endlessly when only connected to LAN nodes?

Again, if your intent is to connect to the Internet DHT nodes, then there is nothing wrong with such behavior. But if you intend to use Tox only for LAN, then you wouldn't want this behavior, as you pointed out. I guess Tox wasn't designed with LAN-only use-case in mind.

from c-toxcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.