Read Bittorrent Summary
I have already seen a period of time. BitTorrent source code main clues are the following:
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 = rate (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 ['recrecest_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 am analyzing in this order, and I mainly analyze these classes, it is really a bit.
"There is no secret under the source code", continue to let us see the secret below the source code.