Commit graph

434 commits

Author SHA1 Message Date
Yuxin Wang
90b3871780 Add is_running() method. 2018-10-10 20:34:15 -04:00
Yuxin Wang
fbd2b1f699 Extract a common _reset() method. 2018-10-10 20:33:32 -04:00
Yuxin Wang
81c58c540b Add simple test_tracker_restart. 2018-10-10 20:32:45 -04:00
Yuxin Wang
3b682471b8 Remove test_tracker_restart temporarily. 2018-10-10 20:31:49 -04:00
Yuxin Wang
ea0d9c1ce7 Move setup_tracker_and_peers to conftest. 2018-10-10 20:28:54 -04:00
Yuxin Wang
5fd2b1e95d Remove self._loop references. 2018-10-10 19:42:54 -04:00
Yuxin Wang
526ac4c083 Fix usage of start. 2018-10-10 19:38:22 -04:00
Yuxin Wang
fd183fc151 Add terminal option to for peer to connect. 2018-10-10 19:35:43 -04:00
Yuxin Wang
6a3ac46c80 Cleanup information when calling stop(). 2018-10-10 19:35:33 -04:00
Yuxin Wang
962a406833 Rename argument option from server to tracker. 2018-10-10 19:35:13 -04:00
Yuxin Wang
7125636e46 Refactor initialization.
Adopt lazy initializations, Peer class now has connect method to connect to tracker.
2018-10-10 19:34:52 -04:00
Yuxin Wang
72ce64f9d4 Rename the parameter. 2018-10-10 18:58:30 -04:00
Yuxin Wang
22cc5302d5 Remove unused variable. 2018-10-10 18:50:52 -04:00
Yuxin Wang
ccf227141c Merge branch 'handle-peer-disconnection' 2018-10-10 18:44:49 -04:00
Yuxin Wang
322ce8f509 Re-order the code for better readability. 2018-10-10 16:51:32 -04:00
Yuxin Wang
5fb29c93a0 Update the chunkinfo and pending_chunknum. 2018-10-10 16:50:53 -04:00
Yuxin Wang
d15c1fbcaa Use await for write_message task. 2018-10-10 16:50:11 -04:00
Yuxin Wang
1e9d908fde Rename to_download to file_chunk_info for better readability. 2018-10-10 16:49:19 -04:00
Yuxin Wang
6621bc4237 No report hook if DEBUG log is turned on. 2018-10-10 16:45:58 -04:00
Yuxin Wang
5366d543f2 Add test for download_disconnect. 2018-10-10 16:42:41 -04:00
Yuxin Wang
c116babab8 Catch ConnectionResetError if the peer has disconnected. 2018-10-10 16:40:54 -04:00
Yuxin Wang
7d78c604e3 Add warning about shutdown. 2018-10-10 16:38:40 -04:00
Yuxin Wang
f48ad06642 Stop internal server first. 2018-10-10 16:38:24 -04:00
Yuxin Wang
1b640977dd Handle if corrupted. 2018-10-10 01:00:34 -04:00
Yuxin Wang
e6f8c82b2a Extract common methods to be reused. 2018-10-10 01:00:03 -04:00
Yuxin Wang
a74e7bc6be Put stop tracker and peer into finally block. 2018-10-10 00:05:24 -04:00
Yuxin Wang
9922339910 Exploit faster peers, add code for peer disconnect. 2018-10-09 23:56:03 -04:00
Yuxin Wang
02199e7b02 Put rename into finally block. 2018-10-09 23:55:25 -04:00
Yuxin Wang
f5c6d1dbe3 Remove downloaded files after test. 2018-10-09 23:54:36 -04:00
Yuxin Wang
eff9a968a5 Put remove file to the finally block. 2018-10-09 23:53:21 -04:00
Yuxin Wang
fc7fe1c59c Add TEST_SMALL_FILE_1 for test_delay(). 2018-10-09 23:53:03 -04:00
Yuxin Wang
68af3ce824 Remove disconnected peers. 2018-10-09 21:52:13 -04:00
Yuxin Wang
f3eb11b138 Remove dead code. 2018-10-09 21:15:48 -04:00
Yuxin Wang
be6ad63795 Add speed tests for peers. 2018-10-09 21:15:17 -04:00
Yuxin Wang
422e08f6f6 Don't have to wait write events. 2018-10-09 21:10:53 -04:00
Yuxin Wang
b2ea25e5e0 Send back ping-pong packet. 2018-10-09 21:09:41 -04:00
Yuxin Wang
929f968775 Put _read_message inside try block. 2018-10-09 21:09:26 -04:00
Yuxin Wang
373adc7e30 Only convert Enum to int if message type header is Enum. 2018-10-09 21:04:23 -04:00
Yuxin Wang
c35c2f2c61 Remove unused message field. 2018-10-09 21:04:01 -04:00
Yuxin Wang
b9805def56 Raise the IncompleteReadError to be catched by caller. 2018-10-09 21:03:46 -04:00
Yuxin Wang
990703b18d Remove LEAVE message and add PEER_PING_PONG message type. 2018-10-09 16:54:30 -04:00
Yuxin Wang
35d95ab5e1 Rename the variable for better readability. 2018-10-09 16:53:47 -04:00
Yuxin Wang
792ff2df67 Move tests for result in try block. 2018-10-09 16:50:23 -04:00
Yuxin Wang
33c44e12b5 Add concurrent download tests. 2018-10-09 16:50:09 -04:00
Yuxin Wang
872615f529 Put remove file in finally block. 2018-10-09 16:37:44 -04:00
Yuxin Wang
bf7941c386 Remove unnecessary notes. 2018-10-09 16:31:39 -04:00
Yuxin Wang
9e98cc3d31 Close the writer if the writer hasn't been closed. 2018-10-09 14:34:19 -04:00
Yuxin Wang
e45db7060e Remove unnecessary file. 2018-10-09 14:32:13 -04:00
Yuxin Wang
c8c58f4c92 Wait longer for tracker code to run. 2018-10-09 01:27:48 -04:00
Yuxin Wang
e01c0ffee1 Add artificial delay for peer. 2018-10-09 01:27:01 -04:00