Commit graph

102 commits

Author SHA1 Message Date
Yuxin Wang
f34e96b077 Add stop method to properly close all connections. 2018-09-30 10:48:54 -04:00
Yuxin Wang
a2c803876a Add return True to exit the cmd loop. 2018-09-30 10:48:27 -04:00
Yuxin Wang
81fb413818 Add simple test. 2018-09-30 10:12:02 -04:00
Yuxin Wang
9b6ddc1940 start listening before accepting clients.
To prevent gaps between calls to start() and clients' connecting.
2018-09-30 10:11:45 -04:00
Yuxin Wang
b161e1dff5 Allow progress fucntion to be none. 2018-09-30 10:10:29 -04:00
Yuxin Wang
d6601b0cec Lazy connection to server for peer. 2018-09-30 10:10:15 -04:00
Yuxin Wang
cc5bbc4701 Initial commit of test module. 2018-09-29 23:42:35 -04:00
Yuxin Wang
f09accc254 Add tox and setup config files. 2018-09-29 23:42:00 -04:00
Yuxin Wang
6f3e3fa1df Add import in __init__ file. 2018-09-29 23:38:54 -04:00
Yuxin Wang
b2bee06af9 Remove unused module. 2018-09-28 00:30:37 -04:00
Yuxin Wang
6e5bf1e4f4 Remove connection lock as it is unnecessary. 2018-09-27 14:30:03 -04:00
Yuxin Wang
90d36db04a Output only ERROR message. 2018-09-27 14:25:31 -04:00
Yuxin Wang
87e84d5f3f Use Peer.CHUNK_SIZE instead of magic number. 2018-09-27 14:25:21 -04:00
Yuxin Wang
4181cfacf3 Abstract CHUNK_SIZE for better management. 2018-09-27 14:20:27 -04:00
Yuxin Wang
9ebf02d2d2 Send fileinfo and chunknum to server.
Server doesn't need to know much detail about the file.
2018-09-27 14:18:57 -04:00
Yuxin Wang
b18be890e4 Add speed display. 2018-09-27 14:06:27 -04:00
Yuxin Wang
5756cf39f2 Remove creating blank file code. 2018-09-27 13:14:41 -04:00
Yuxin Wang
282ac08fc8 Compress the packets sent over the network. 2018-09-27 13:11:21 -04:00
Yuxin Wang
99c1381abe Write to temp file, rename afterwards. 2018-09-27 09:06:38 -04:00
Yuxin Wang
e7016c9a98 Print the download message. 2018-09-27 09:05:18 -04:00
Yuxin Wang
606f1ac98d Add todos. 2018-09-26 23:33:49 -04:00
Yuxin Wang
93d4a9b466 Tabulate the output. 2018-09-26 23:33:01 -04:00
Yuxin Wang
7671eddb8c Implement progressbar. 2018-09-26 23:24:49 -04:00
Yuxin Wang
e2d130e687 Add list_peers command for Peer. 2018-09-26 23:16:33 -04:00
Yuxin Wang
f0740851d5 Move request chunk register message to download method. 2018-09-26 23:11:02 -04:00
Yuxin Wang
99bd980f10 Use plain list to store chunk num. 2018-09-26 22:59:54 -04:00
Yuxin Wang
3720d0613e Remove unused message type. 2018-09-26 22:59:18 -04:00
Yuxin Wang
e087b1f7f4 Implement download method. 2018-09-26 22:20:22 -04:00
Yuxin Wang
0d77334bff Check if same file is being downloaded. 2018-09-26 22:18:56 -04:00
Yuxin Wang
b3ad70a229 Add check for None. 2018-09-26 22:18:20 -04:00
Yuxin Wang
829ec58c47 Add fileinfo into message of FILE_LOCATION. 2018-09-26 21:20:53 -04:00
Yuxin Wang
144f0c8916 Pretty print the log. 2018-09-26 21:15:26 -04:00
Yuxin Wang
930be3cb96 Implement request/reply file location. 2018-09-26 21:12:24 -04:00
Yuxin Wang
bb06947048 Use Queue() for synchronization. 2018-09-26 21:11:52 -04:00
Yuxin Wang
01dd79b974 Add exit method. 2018-09-26 21:10:30 -04:00
Yuxin Wang
d3901e740e Add error hanlding for messages. 2018-09-26 21:01:11 -04:00
Yuxin Wang
f56bc1c33d Re-order the code and notes. 2018-09-26 19:49:17 -04:00
Yuxin Wang
84c66d3067 Print tabulate instead of pure objects. 2018-09-26 17:52:02 -04:00
Yuxin Wang
195e01f139 Return a tuple to hide the internal implementation. 2018-09-26 17:51:23 -04:00
Yuxin Wang
d25f3dad15 Return just values to prevent printing trash. 2018-09-26 17:35:12 -04:00
Yuxin Wang
04fd311cca Add list chunkinfo command. 2018-09-26 17:34:34 -04:00
Yuxin Wang
b1dc0b9430 Move download method to peer. 2018-09-26 17:33:49 -04:00
Yuxin Wang
42e40a535c Add refresh file list in download method. 2018-09-26 17:31:14 -04:00
Yuxin Wang
f799119a69 Add call for release() once the method finishes. 2018-09-26 17:21:26 -04:00
Yuxin Wang
61ba4fb321 Delay the deletion. 2018-09-26 17:21:09 -04:00
Yuxin Wang
2a26d67430 Add some notes. 2018-09-26 17:20:29 -04:00
Yuxin Wang
23f269d63c Add thread-safety as a TODO. 2018-09-26 17:20:16 -04:00
Yuxin Wang
2eeb3fa529 Add more notes. 2018-09-26 16:23:11 -04:00
Yuxin Wang
16f66910a2 Implement simple cmd terminal. 2018-09-26 11:12:39 -04:00
Yuxin Wang
f7d5c0db35 Improve notes. 2018-09-26 11:12:24 -04:00