Code Monkey home page Code Monkey logo

libtorrent-node's People

Contributors

mnaamani avatar rllola avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

rdewilde abigbug

libtorrent-node's Issues

Extend torrent_status encoding

Add the following fields to encoding for libtorrent::torrent_status:

  • int total_done
  • boost::int64_t total_download
  • boost::int64_t total_upload
  • int download_rate
  • int upload_rate
  • int uploads_limit
  • int num_connections
  • int num_pieces
  • int num_seeds
  • int num_peers

Missing fields from add_torrent_params

Background

We are missing the boost::uint64_t flags field in the current bindings, which is set to a combinatino of values

enum flags_t
        {
                flag_seed_mode = 0x001,
                flag_override_resume_data = 0x002,
                flag_upload_mode = 0x004,
                flag_share_mode = 0x008,
                flag_apply_ip_filter = 0x010,
                flag_paused = 0x020,
                flag_auto_managed = 0x040.
                flag_duplicate_is_error = 0x080,
                flag_merge_resume_trackers = 0x100,
                flag_update_subscribe = 0x200
        };

Problem

Is needed for github.com/JoyStream/joystream-electron.

Solution

Add to bindings, and export enumeration also.

Libtorrent setting packs binding

Background

Libtorrent session allow you to pass settings to the session.

Problem

Today the settings are hard coded.

Solution

Create bindings so we can choose the settings from the javascript code and that it is no more hard coded in libtorrent-node.

Decoding strings recklessly

The macro for doing string decoding currently turns undefined into the string "undefined". While this is actually what javascript does natively, it is happening in contexts where this is not what is intended. One example is the url key of the add_torrent_params.

The best approach is likely to keep the core decoding macro compatible with the javascript approach, and to make the context specific decoding more intelligent. E.g. the add_torrent_params::url should be set to a default constructed std::string.

Also check what happens of other special javascript types like

  • NaN
  • null
    etc.

Wasteful read_piece_alert processing

Background

Processing most alerts is a trivial resource burden, with the read_piece_alert being a significant exception. It requires copying a buffer owned by the libtorrent thread into the V8 memory space, often in the range of 0.1-0.5MB.

Problem

With a large number of torrents, all with thousands of pieces, this can get very expensive. In particular in combination with the extension in https://github.com/JoyStream/joystream-node it gets worse, as the alert will arrive for each time we want to read a piece for seeding, which may be happening to many peers on a single torrent.

The only reason libtorrent itself does not need to offer such control is because it does not automatically copy the content from the libtorrent thread to the user thread, however these bindings do.

The only scenario it really makes sense to process this alert in these bindings is when consuming the actual content in nodejs is relevant, which is pretty much only of some sort of streaming playback is being done at the nodejs application level.

Solution

Some way of controlling whether this alert should be processed on a given torrent at any given time.

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.