Giter Club home page Giter Club logo

dtorrent_task's Introduction

dtorrent_task's People

Contributors

eclipseglory avatar kabadh avatar moham96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dtorrent_task's Issues

Provide a way to create metainfo file ".torrent" file

Using this library how can I create the torrent (and seed, as the creator will be first seeder) from a file in my system, and download that file in another system. Upon googling I found out that I need to make a SHA1 hash out of info dictionary of the torrent, and when I looked into the code of dtorrent_task, I found out it expects parameters like 'name', 'path', 'file' to properly make the dictionary (under the function parseTorrentFileContent).
Am I on the right track? Is it possible to create a torrent using this library? If not, then how could I do it in dart?

utp selectiveAck extension crashes sometimes

sometimes the utp peer crash with this exception

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (length): Invalid value: Not in inclusive range 0..576460752303423487: -40608
#0      new _List.filled (dart:core-patch/array.dart)
#1      UTPSocketImpl.newSelectiveACK (package:utp_protocol/src/utp_socket_impl.dart:851:19)
#2      UTPSocketImpl.sendPacket (package:utp_protocol/src/utp_socket_impl.dart:1006:26)
#3      UTPSocketImpl.requestSendAck.<anonymous closure> (package:utp_protocol/src/utp_socket_impl.dart:881:12)
#4      Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#5      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#6      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#7      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

this looks like a race condition or incorrect calculation of seq numbers, in any case i don't have reproducible steps for this crash, it happens rarely on my machine that makes it hard to debug and trace

Parse magnet links

I only see downloading through torrent, or is there a way to convert magnet links to torrent first?

Optimizing

Currently the program is using a bit too much CPU due to multiple reasons:

  • we should try to avoid the use of collection functions since most of them has O(n) complexity, this needs quite a bit of research and testing since it may require testing alternative data structures or maybe roll our own data structures.

  • we should reduce the amount of I/O usage and save the piece in memory before writing to file, validating the piece before that.

  • we should investigate the possibility of caching the files in memory because reading a block each time we want to upload is expensive, maybe we need to use mmap which is not possible out of the box in dart right now

  • decouple the parts of dtorrent_task like PeersManager, Peer, PieceManager and DownloadManager similar to how the webtorrent and peerflix are structured

Only one peer is connected at a time

Upon analysing the terminal I realised that all data is only being downloaded from one Peer here it is 66.42.170.16 and it is not being connected to any other

[_TCPPeer] Sending have information to the peer: [0, 0, 0, 0], 227
[_TCPPeer] Received request for Piece (228, 147456) content, downloaded 59473920 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 163840) content, downloaded 59490304 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 180224) content, downloaded 59490304 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 196608) content, downloaded 59523072 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 212992) content, downloaded 59523072 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 229376) content, downloaded 59555840 bytes from the current Peer PeerType.TCP 66.42.170.16:5988
[_TCPPeer] Received request for Piece (228, 245760) content, downloaded 59555840 bytes from the current Peer PeerType.TCP 66.42.170.16:5988

Doesn't work with flutter 3.19. Update packages.

Because every version of flutter from sdk depends on meta 1.11.0 and events_emitter2 >=1.0.3 depends on
meta >=1.9.0 <=1.10.0, flutter from sdk is incompatible with events_emitter2 >=1.0.3.
And because dtorrent_task >=0.3.3 depends on events_emitter2 ^1.0.3, flutter from sdk is incompatible
with dtorrent_task >=0.3.3.
So, because deckr depends on both dtorrent_task ^0.3.3 and flutter from sdk, version solving failed.

Use concurrency when possible

Currently testing the streaming feature i see that the http server is causing the download task to lag and the whole app to have a lag.
The code should use concurrency when possible, for now especially the http server used for streaming videos should run in it's own isolate

task.stop function does not stop the torrent at all

as the name suggests, the torrent doesn't stop seeding and i have no idea why. I'm on the latest from pub.
I dug though the task.dart file and did find that there is a bool for a force mode but it cannot be called and is always set to false. might fix it if it was made to be toggle-able.

update pub? missing exports

I have 0.3.3, but it doesn't have:

export 'src/stream/stream.dart';
export 'src/stream/stream_events.dart';
export 'src/task_events.dart';

Do you need to post the latest to pub.dev?

explain this .bt.state file

I noticed that if I try to download a file twice, the second time it doesn't work.

I found this state file: 51eb9f733ceb792822d6cfa62b0a033b7b3732b1.bt.state

If I delete that it works. What is this and do I need to delete it everytime?

how get rid of print(), log(), dev.log() etc.

seeing all this in the console. How turn off?


[_TCPPeer] Sending bitfile information to the peer: [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
[_TCPPeer] process have all : 192.228.165.219:51414
[_TCPPeer] remote unchoke me : 192.228.165.219:51414
[PeersManager] Processing Extended Message handshake
[_TCPPeer] Connection is closed 77.99.176.239:23710
[PeersManager] registering extensions for peer 77.99.176.239:23710
[_TCPPeer] Sending bitfile information to the peer: [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 239, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]
[PeersManager] Processing Extended Message handshake
[_TCPPeer] remote choke me : 179.9.167.86:48486


high cpu usage

some problem related mostly to the streaming feature:

1- This line and the pipeline that it is calling are causing degradation in performance because the functions involved in pushing the bytes like _calculateLastDownloadedByte are time consuming.

_bytesRequestController.add(null);

2- currently streaming is not very responsive because the read request has to wait before it is processed and returned

3- non flushed pieces are not read, because we are using 2 different file handles, one for writing and one for reading, and the reading handle will not be able to read non flushed bytes

4- since we are using different handles for read and write, we should have two streams to handle read and write requests

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.