Protocol core-core Version 3 » History » Version 28
Greg Burri, 07/09/2009 01:29 PM
1 | 1 | Greg Burri | h1. Protocols |
---|---|---|---|
2 | |||
3 | This page describes the protocols used by Aybabtu for network communication between cores and between core and GUI. |
||
4 | |||
5 | 7 | Greg Burri | h2. Core <-> Core |
6 | 1 | Greg Burri | |
7 | 21 | Greg Burri | h3. Notes pour plus tards |
8 | |||
9 | 22 | Greg Burri | * Le message _HaveChunks_ doit être multicast et la réponse est un datagramme UDP. Il n'est pas possible de maintenir N-1 connexion TCP en permanence ou N est le nombre de peer. (à mesurer). DU coup ce message peut remplacer le _IMAlive_ |
10 | 21 | Greg Burri | |
11 | |||
12 | 23 | Greg Burri | See source:protos/network_protocol.proto for message details. |
13 | 1 | Greg Burri | |
14 | 23 | Greg Burri | There is no more than one downloading from B to A. A peer which a download is active is setted as not free. |
15 | |||
16 | There is _NbDownloadThread_ thread T. Each thread will choose a free chunk and download it. Here is the thread loop. |
||
17 | <pre> |
||
18 | 27 | Greg Burri | F : the list of all unfinished download |
19 | C : A list of chunk candidates (empty at start) |
||
20 | |||
21 | While not end of F |
||
22 | 28 | Greg Burri | - Take the next file in F -> f. |
23 | 27 | Greg Burri | If the hash chunks of a file are unknown : |
24 | - Ask the hashes to the source (see the message _GetHashes _). |
||
25 | For each chunk not downloaded or not being downloaded -> c : |
||
26 | If c has a free peer : |
||
27 | - add c to C |
||
28 | If C isn't empty : |
||
29 | - Take the best chunk in C based on peer.downloadRate. If there is more than one best chunk then choose one randomly. |
||
30 | - Grab the lock for the peer |
||
31 | - Request the download |
||
32 | 23 | Greg Burri | </pre> |
33 | |||
34 | |||
35 | |||
36 | 8 | Greg Burri | h3. Parameters |
37 | |||
38 | 10 | Greg Burri | Most parameters will be stored as constants in their component. |
39 | |||
40 | 9 | Greg Burri | |_.Name|_.Value |_.Unit|_.Explanation/Comments| |
41 | 19 | Greg Burri | | _IMAliveFrequency_ | 0.1 | [Hz] | The message _IMAlive_ is sent each 10s. | |
42 | 14 | Greg Burri | | _ChunkSize_ | 33554432 | [Byte] | (32 MB) | |
43 | | _LanSpeed_ | 52428800 | [Byte/s] | (50 MB/s) | |
||
44 | 17 | Greg Burri | | _TimeRecheckChunkFactor_ | 4 | - | If the time to download a chunk exceeds _TimeRecheckChunkFactor_ * _ChunkSize_ / _LanSpeed_ the peers are rescanned to choose a better one (better download rate). For example : 4 * 32 / 50 = 2.6 second | |
45 | | _SwitchToAnotherPeerFactor_ | 1.5 | - | During the recheck of the peers to choose a better one the other download rate must be above the current * 1.5. | |
||
46 | | _DownloadRateValidTime_ | 1500 / _LanSpeed_ = 300 s | [s] | (5 min). The download rate of a peer is only valid during this time after its last update. After that its rate is set to the maximum. | |
||
47 | 15 | Greg Burri | | _TimeBetweenChunksUpdate_ | 500 / _LanSpeed_ = 10 s | [s] | Each 10 s a daemon will scan the _NumberOfChunkToUpdate_ first chunks from the first queued downloads to know which peer has which chunk. | |
48 | 20 | Greg Burri | | _NumberOfChunkToUpdate_ | 100 * _LanSpeed_ / _ChunkSize_ = 156 | - | The first 156 hash chunks (3 kB) will by send periodically to each peer. See message _HaveChunks_ in the proto file. | |
49 | 19 | Greg Burri | | _FindTimeout_ | 15 | [s] | A search request is abandoned after 15 seconds from the start of the request. See message _Find_. | |
50 | 25 | Greg Burri | | _GetHashesTimeout_ | 200 | [s] | Timeout for the message _GetHashes_. | |
51 | 19 | Greg Burri | | _GetChunkTimeout_ | 10 | [s] | Timeout for the message _GetChunk_. | |
52 | | _HaveChunksTimeout_ | _TimeBetweenChunksUpdate_ = 10 | [s] | Timeout for the message _HaveChunks_. | |
||
53 | 1 | Greg Burri | | _GetEntriesTimeout_ | 10 | [s] | Timeout for the message _GetEntries_. | |
54 | 23 | Greg Burri | | _NbDownloadThread_ | 3 | - | Number of concurrent downloading thread. | |
55 | 26 | Greg Burri | | _BufferSize_ | 1048576 | [Byte] | (1MB). This buffer is user when reading or writing a file. | |
56 | | _TCPSocketBufferSize_ | 33554432 | [Byte] | (32Mo). Used when data are received. See _QAbstractSocket::setReadBufferSize_. | |
||
57 | 8 | Greg Burri | |
58 | 7 | Greg Burri | h2. Core <-> GUI |