Commit graph

306 commits

Author SHA1 Message Date
Yuxin Wang
400be652a5 Add await for is_connected() method. 2018-10-11 20:43:56 -04:00
Yuxin Wang
5574b6de72 Add check for closing writers. 2018-10-11 20:43:38 -04:00
Yuxin Wang
6a50e38aef Allow double stop. 2018-10-11 18:14:33 -04:00
Yuxin Wang
fbdfa28998 Fix typo. 2018-10-11 18:14:07 -04:00
Yuxin Wang
b95d8593f5 Handle ConnectionResetError. 2018-10-11 18:14:01 -04:00
Yuxin Wang
4a1f536ad5 Test connectivity before doing actual work. 2018-10-11 18:13:44 -04:00
Yuxin Wang
b011a374ae list_file now returns 2 results.
1 for file_list, 1 for error message.
2018-10-11 18:10:02 -04:00
Yuxin Wang
9686404267 Add start command for tracker. 2018-10-11 18:08:51 -04:00
Yuxin Wang
d2c4543fbb Add test for tracker disconnect. 2018-10-11 18:08:39 -04:00
Yuxin Wang
2f81ea162a Auto start peer's server and stop the peer/tracker when Ctrl-C is hit. 2018-10-11 17:24:07 -04:00
Yuxin Wang
8df32ffcbf Fix typo. 2018-10-10 21:55:19 -04:00
Yuxin Wang
4babfcbfea Remove unnecessary code. 2018-10-10 21:31:44 -04:00
Yuxin Wang
4829c6a21d Add todo notes. 2018-10-10 21:25:15 -04:00
Yuxin Wang
041bf141d6 Add check if no peer possesses the chunk. 2018-10-10 21:21:11 -04:00
Yuxin Wang
5fffc1dd30 Fix typo. 2018-10-10 21:20:57 -04:00
Yuxin Wang
23420f4304 Move code to common method. 2018-10-10 21:19:45 -04:00
Yuxin Wang
8e5d81cea5 Add more tests for test_tracker_restart. 2018-10-10 21:02:52 -04:00
Yuxin Wang
9d42555e46 Fix is_connected() method. 2018-10-10 21:02:35 -04:00
Yuxin Wang
c8a4d72f19 Add TODO notes. 2018-10-10 20:39:39 -04:00
Yuxin Wang
65ec5f978e Merge branch 're-startable', make peer and tracker re-startable. 2018-10-10 20:35:59 -04:00
Yuxin Wang
7487bc58f8 Add is_connect() and disconnect() method. 2018-10-10 20:35:44 -04:00
Yuxin Wang
a3b72c41a2 Add test for running status. 2018-10-10 20:34:52 -04:00
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