Code Monkey home page Code Monkey logo

Comments (4)

GGist avatar GGist commented on July 29, 2024

I was intending bip_handshake to be a central crate for all peer discovery services (trackers, dht, pex, etc) to be able to forward contact information to in an asynchronous fashion (synchronous is possible, but our BTHandshaker just sends the connect over to the mio event loop asynchronously). Because of this, I wouldn't have to export an asynchronous interface (token or callback based) for every peer discovery service, they would just asynchronously forward the contact information over to the Handshaker which would act on that information. This is because in most cases, this is what the client wants anyway, for other cases, see my last block of text.

However as you can see, some services also have metadata associated with requests such as trackers which, in addition to contact information, also return swarm statistics, and announce intervals and for these, I have no choice but to offer a crate specific asynchronous interface, but the contact information is still passed through the Handshaker asynchronously and so is not exposed with the metadata. Services like the DHT don't have metadata associated with requests so it was not necessary to have anything other than the Handshaker (not sure about PEX).

To address your second point, the Handshaker was intended to be composable so that if you wanted to, you could provide a sort of MockHandshaker which could pool or forward the connection requests to a client wanting to have more control over things.

from bip-rs.

GGist avatar GGist commented on July 29, 2024

Yes, I do intend to start a project that combines the various crates. Such a project would be external to bip-rs and would be sort of a reference torrent client similar to what libtorrent offers.

However, currently I am working on the bip_peer module so such an application wouldn't start development anytime soon. That being said, I appreciate the use cases you are bringing up as it is helpful in rethinking how each of the bip_* modules fit together.

from bip-rs.

GGist avatar GGist commented on July 29, 2024

Just to add on to my first comment, coupling the peer discovery services and the Handshaker was intended. However, approaching this issue from the perspective of a client that needs loose coupling (at least loose coupling from BTHandshaker) they can provide their own Handshaker and do whatever they want with the information provided to it.

from bip-rs.

astro avatar astro commented on July 29, 2024

Ok.

To me the moniker Handshaker indicated that this was all about initiating wire connections. For the other purpose, how about calling that something like SwarmInfo?

from bip-rs.

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.