joystreamclassic / libtorrent-node Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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
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
};
Is needed for github.com/JoyStream/joystream-electron.
Add to bindings, and export enumeration also.
Libtorrent session allow you to pass settings to the session.
Today the settings are hard coded.
Create bindings so we can choose the settings from the javascript code and that it is no more hard coded in libtorrent-node.
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
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.
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.
Some way of controlling whether this alert should be processed on a given torrent at any given time.
NAN_METHOD(TorrentInfo::NewInstance)
does not throw a js exception when the torrent file loading from disk fails, this is required for https://github.com/JoyStream/joystream-electron/issues/68
As we did for joystream-node make it build with node-gyp.
This also means updating the conan recipie LibtorrentNode used by joystream-node
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.