Inheritance diagram for Protocols::BitTorrent::Transfers::Testing::ChokerTest:


Definition at line 38 of file ChokerTest.cpp.
Public Member Functions | |
| ChokerTest () | |
| void | setUp () |
| void | tearDown () |
| void | sessionsStateSetPeerIsChoked (const Sessions &sessions, bool choked) |
| Stubbes isPeerChoked() with choked for sessions. | |
| void | sessionsStateSetPeerIsInterested (const Sessions &sessions, bool interested) |
| Stubbes isPeerChoked() with interested for sessions. | |
| void | sessionsStateSetPeerIsSeeder (const Sessions &sessions, bool seeder) |
| Stubbes isPeerChoked() with choked for sessions. | |
| void | sessionsStateSetWeAreSnubbed (const Sessions &sessions, bool snubbed) |
| Stubbes areWeSnubbed() with choked for sessions. | |
| void | refOpenSessions (const Sessions &sessions) |
| Adds a newly opened sessions to Choker. | |
| void | refCloseSessions (const Sessions &sessions) |
| Reports to Choker that the sessions were closed. | |
| void | refChokingTimeUnchokeChokeSessions (const Sessions &unchokedSessions, const Sessions &chokedSessions, const QList< int > &randomInts=QList< int >()) |
| Chokes and unchokes sessions when the choking time comes. | |
| void | testStartingChokerStartsTheTimer () |
| Starting the Choker should result in starting the choking timer. | |
| void | testStoppingChokerStopsTheTimer () |
| When the choker is stopped the choking timer should be stopped too. | |
| void | testAddOneSessionItGetsUnchokedNextChokingTime () |
| A newly opened session is initially choked but is then unchoked. | |
| void | testAddFourSessionsAllGetUnchokedNextChokingTime () |
| Four new sessions are unchoked after they have been added. | |
| void | testAddFiveSessionsFiveNotInterestedGetUnchokedNextChokingTime () |
| Not interested sessions are always unchoked according to specs. | |
| void | testAddFiveSessionsFourInterestedGetUnchokedNextChokingTime () |
| If all sessions are interested, then only the first four get unchoked. | |
| void | testFifthSessionUnchokedDuringFirstOptimisticUnchoking () |
| Verify optimistic choking works with all sessions having equal ratings. | |
| void | testForthSessionUnchokedDuringSecondUnchoking () |
| Verify optimistic choking works with all sessions having equal ratings. | |
| void | testOptimisticUnchokeDoesNotChangeFor2ChokingTimes () |
| The optimistic unchoke will not change even if we download nothing. | |
| void | testUnchokePeersWeDownloadFastestFrom () |
| Fastest peers we download from should be unchoked. | |
| void | testAntiSnubbingOneSnubbedSessionTwoOptimisticChokes () |
| Snubbed unchoked sessions are choked during optimistic unchoking. | |
| void | testAntiSnubbingHasNoEffectWhenNoConnectionsAreChoked () |
| Even if we are snubbed we could do nothing if there's noone to unchoke. | |
| void | testClosedSessionsAreNeitherChokedNorUnchokedAnymore () |
| Closing a session should get it removed from the Choker's internal list. | |
| void | testSeedersAreAlwaysKeptChoked () |
| Seeding peers should always be choked, they are not downloaders. | |
| void | testSeedersAreNeverOptimisticlyUnchoked () |
| Seeding peers should never be optimisticly unchoked. | |
| void | testOptimisticUnchokingPicksRandomlyFromMultipleCandidates () |
| Randomly pick a candidate for optimistic unchoking. | |
| void | testUnchokeSessionsWithHighestUploadRateWhenInSeedingMode () |
| void | testWeIngnoreBeingSnubbedWhenWeAreInSeedingMode () |
| No additional optimistic unchokes per snubbed session if only seeding. | |
Private Types | |
| typedef QList< TransferSessionMock * > | Sessions |
| typedef QMap< TransferSessionMock *, SessionState > | SessionsStateMap |
Private Member Functions | |
| CPPUNIT_TEST_SUITE (ChokerTest) | |
| CPPUNIT_TEST (testStartingChokerStartsTheTimer) | |
| CPPUNIT_TEST (testStoppingChokerStopsTheTimer) | |
| CPPUNIT_TEST (testAddOneSessionItGetsUnchokedNextChokingTime) | |
| CPPUNIT_TEST (testAddFourSessionsAllGetUnchokedNextChokingTime) | |
| CPPUNIT_TEST (testAddFiveSessionsFiveNotInterestedGetUnchokedNextChokingTime) | |
| CPPUNIT_TEST (testAddFiveSessionsFourInterestedGetUnchokedNextChokingTime) | |
| CPPUNIT_TEST (testFifthSessionUnchokedDuringFirstOptimisticUnchoking) | |
| CPPUNIT_TEST (testForthSessionUnchokedDuringSecondUnchoking) | |
| CPPUNIT_TEST (testOptimisticUnchokeDoesNotChangeFor2ChokingTimes) | |
| CPPUNIT_TEST (testUnchokePeersWeDownloadFastestFrom) | |
| CPPUNIT_TEST (testAntiSnubbingOneSnubbedSessionTwoOptimisticChokes) | |
| CPPUNIT_TEST (testAntiSnubbingHasNoEffectWhenNoConnectionsAreChoked) | |
| CPPUNIT_TEST (testClosedSessionsAreNeitherChokedNorUnchokedAnymore) | |
| CPPUNIT_TEST (testSeedersAreAlwaysKeptChoked) | |
| CPPUNIT_TEST (testSeedersAreNeverOptimisticlyUnchoked) | |
| CPPUNIT_TEST (testOptimisticUnchokingPicksRandomlyFromMultipleCandidates) | |
| CPPUNIT_TEST (testUnchokeSessionsWithHighestUploadRateWhenInSeedingMode) | |
| CPPUNIT_TEST (testWeIngnoreBeingSnubbedWhenWeAreInSeedingMode) | |
| CPPUNIT_TEST_SUITE_END () | |
Private Attributes | |
| auto_ptr< TimerMock > | timer |
| auto_ptr< RandomNumberGeneratorMock > | randomNumberGenerator |
| auto_ptr< TransferManagerStateMock > | transferManagerState |
| auto_ptr< Choker > | chokerReal |
| auto_ptr< ChokerDriver > | choker |
| Sessions | sessions |
| SessionsStateMap | sessionsState |
| Sessions | openedSessions |
| const Choke | choke |
| const Unchoke | unchoke |
| QList< int > | randomIntsZero |
| QList< int > | randomIntsZeroZero |
| bool | isTestingSeedingMode |
Static Private Attributes | |
| static const int | SessionsCount = 10 |
Classes | |
| struct | SessionState |
|
|
Definition at line 75 of file ChokerTest.cpp. |
|
|
Definition at line 76 of file ChokerTest.cpp. |
|
|
Definition at line 95 of file ChokerTest.cpp. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||
|
Chokes and unchokes sessions when the choking time comes.
Definition at line 200 of file ChokerTest.cpp. |
|
|
Reports to Choker that the sessions were closed.
Definition at line 178 of file ChokerTest.cpp. |
|
|
Adds a newly opened sessions to Choker.
Definition at line 168 of file ChokerTest.cpp. |
|
||||||||||||
|
Stubbes isPeerChoked() with choked for sessions.
Definition at line 139 of file ChokerTest.cpp. |
|
||||||||||||
|
Stubbes isPeerChoked() with interested for sessions.
Definition at line 146 of file ChokerTest.cpp. |
|
||||||||||||
|
Stubbes isPeerChoked() with choked for sessions.
Definition at line 154 of file ChokerTest.cpp. |
|
||||||||||||
|
Stubbes areWeSnubbed() with choked for sessions.
Definition at line 161 of file ChokerTest.cpp. |
|
|
Definition at line 107 of file ChokerTest.cpp. |
|
|
Definition at line 123 of file ChokerTest.cpp. |
|
|
Not interested sessions are always unchoked according to specs.
Definition at line 292 of file ChokerTest.cpp. |
|
|
If all sessions are interested, then only the first four get unchoked.
Definition at line 301 of file ChokerTest.cpp. |
|
|
Four new sessions are unchoked after they have been added.
Definition at line 284 of file ChokerTest.cpp. |
|
|
A newly opened session is initially choked but is then unchoked.
Definition at line 276 of file ChokerTest.cpp. |
|
|
Even if we are snubbed we could do nothing if there's noone to unchoke.
Definition at line 463 of file ChokerTest.cpp. |
|
|
Snubbed unchoked sessions are choked during optimistic unchoking. If we have unchoked peers that stubbed us, then we shoke these peers and assign these slots to optimistic unchoking. Then we will do more than one optimistic unchoke. In this test we have two connections that are choked. When time for optimistic unchoking comes, then we choke the snubbed session and unchoke two instead of one session optimisticly. Definition at line 447 of file ChokerTest.cpp. |
|
|
Closing a session should get it removed from the Choker's internal list. If we open a session and close it right away before the first unchoking round then the session should not be unchoked in the first round to come because it has already been closed. Definition at line 481 of file ChokerTest.cpp. |
|
|
Verify optimistic choking works with all sessions having equal ratings.
This test also verifies that sessions are consistently choked/unchoked. This means, a session that has already been choked is not choked again, a session that has already been unchoked is not unchoked again. Only changes in the state result in sending out packets. That is seen by the fact that during the second choking time no choke/unchoke packets are sent. Definition at line 323 of file ChokerTest.cpp. |
|
|
Verify optimistic choking works with all sessions having equal ratings. After first optimistic unchoking 4th session is choked and 5th is unchoked. The second optimistic unchoking chokes the 5th session and unchokes again the 4th session. This is done with all sessions having equal ratings. The sorting algorithm should be stable and this tests verifeis that. Definition at line 345 of file ChokerTest.cpp. |
|
|
The optimistic unchoke will not change even if we download nothing. We will unchoke sessions from which we download a lot but we keep choked. The exception is when we have optimistic unchokes. Optimistic unchokes will not be choked in favor of a session from which we download better. We could only do that at the next optimistic unchoking round. Even though we download with 5b/s from session [3] and download nothing from session [4], we will not choke session [4] in favore of session [3] because session [4] was our optimistic unchoke. Definition at line 368 of file ChokerTest.cpp. |
|
|
Randomly pick a candidate for optimistic unchoking.
Definition at line 533 of file ChokerTest.cpp. |
|
|
Seeding peers should always be choked, they are not downloaders. Sessions that start as seeders are never unchoked even if there are enough upload slots. Sessions that have turned into seeders must be choked. Definition at line 494 of file ChokerTest.cpp. |
|
|
Seeding peers should never be optimisticly unchoked.
Definition at line 506 of file ChokerTest.cpp. |
|
|
Starting the Choker should result in starting the choking timer. We verify that the timer is initialized with the correct handler function and the correct timeout interval. Definition at line 255 of file ChokerTest.cpp. |
|
|
When the choker is stopped the choking timer should be stopped too.
Definition at line 267 of file ChokerTest.cpp. |
|
|
Fastest peers we download from should be unchoked. The fastests interested peers we download from get unchoked. The ones that are not interested but even faster get unchoked too. Definition at line 387 of file ChokerTest.cpp. |
|
|
Definition at line 548 of file ChokerTest.cpp. |
|
|
No additional optimistic unchokes per snubbed session if only seeding.
Definition at line 600 of file ChokerTest.cpp. |
|
|
Definition at line 87 of file ChokerTest.cpp. |
|
|
Definition at line 82 of file ChokerTest.cpp. |
|
|
Definition at line 81 of file ChokerTest.cpp. |
|
|
Definition at line 91 of file ChokerTest.cpp. |
|
|
Definition at line 85 of file ChokerTest.cpp. |
|
|
Definition at line 89 of file ChokerTest.cpp. |
|
|
Definition at line 90 of file ChokerTest.cpp. |
|
|
Definition at line 79 of file ChokerTest.cpp. |
|
|
Definition at line 83 of file ChokerTest.cpp. |
|
|
Definition at line 92 of file ChokerTest.cpp. |
|
|
Definition at line 84 of file ChokerTest.cpp. |
|
|
Definition at line 78 of file ChokerTest.cpp. |
|
|
Definition at line 80 of file ChokerTest.cpp. |
|
|
Definition at line 88 of file ChokerTest.cpp. |