Read BitTorrent Summary

Source: Internet
Author: User

Read BitTorrent Summary
I have read the BitTorrent source code for a while. The main clues are as follows:
Parseargs
|
V
Rawserver = rawserver (doneflag, config ['timeout _ check_interval '], config ['timeout'], errorfunc = errorfunc)
|
V
Storage = storage (files, open, path. exists, path. getsize)
|
V
Storagewrapper = storagewrapper (storage, config ['Download _ slice_size '], pieces, info ['piece length'], finished, failed, statusfunc, doneflag, config ['check _ hashes '], data_flunked)
|
V
Choker = choker (config ['max _ uploads'], rawserver. add_task, finflag. isset, config ['min _ uploads'])
|
V
Upmeasure = measure (config ['max _ rate_period '],
Config ['upload _ rate_fudge '])
|
V
Ratemeasure = ratemeasure (storagewrapper. get_amount_left ())
|
V
Picker = piecepicker (LEN (pieces), config ['rarest _ first_cutoff '], config ['rarest _ first_priority_cutoff'])
|
V
Downloader = downloader (storagewrapper, Picker,
Config ['request _ backlog'], config ['max _ rate_period '],
Len (pieces), downmeasure, config ['snub _ time'],
Ratemeasure. data_came_in)
|
V
Connecter = connecter (make_upload, downloader, choker,
Len (pieces), upmeasure, config ['max _ upload_rate '] * 1024, rawserver. add_task)
|
V
Encoder = encoder (connecter, rawserver,
Myid, config ['max _ message_length '], rawserver. add_task,
Config ['keepalive _ interval'], infohash, config ['max _ initiate'])
|
V
Rerequest = rerequester (response ['announce '], config ['rerequest _ interval'],
Rawserver. add_task, connecter. how_many_connections,
Config ['min _ peers'], encoder. start_connection,
Rawserver. external_add_task, storagewrapper. get_amount_left,
Upmeasure. get_total, downmeasure. get_total, listen_port,
Config ['IP'], myid, infohash, config ['HTTP _ timeout'], errorfunc,
Config ['max _ initiate'], doneflag)
|
V
Downloaderfeedback (choker, rawserver. add_task, statusfunc,
Upmeasure. get_rate, downmeasure. get_rate,
Upmeasure. get_total_megs, downmeasure. get_total_megs, ratemeasure. get_time_left,
Ratemeasure. get_size_left, file_length, finflag,
Config ['display _ interval '], spewflag)
|
V
Rawserver. listen_forever (encoder)
Storage. Close ()
Rerequest. Announce (2)

I analyzed it in this order. After the analysis, I mainly analyzed these classes. At this time, it was really a bit
"No secret under the source code", let's continue to look at the secret under the source code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.