Commit graph

116 commits

Author SHA1 Message Date
Yuxin Wang
468df73f08 Add timeout to prevent forever waiting. 2018-10-01 15:18:12 -04:00
Yuxin Wang
2450554ffb Start server after test files are created. 2018-10-01 15:17:53 -04:00
Yuxin Wang
8b6dc6a875 Use base class' stop.
The initiative connection is now managed by the base class.
2018-10-01 00:14:59 -04:00
Yuxin Wang
8db86a7ab4 Use with statement. 2018-10-01 00:14:26 -04:00
Yuxin Wang
590e9cd93f Add initiative connections to connection set. 2018-10-01 00:14:16 -04:00
Yuxin Wang
9bd517fd4f Fix exception capture. 2018-10-01 00:13:30 -04:00
Yuxin Wang
6d06b7900c Add more notes. 2018-10-01 00:13:18 -04:00
Yuxin Wang
e6e996abf9 Use set to manage the connections. 2018-10-01 00:12:58 -04:00
Yuxin Wang
54bc2c901a Replace exit with stop. 2018-09-30 14:22:55 -04:00
Yuxin Wang
b777ebb616 Fix peer name. 2018-09-30 13:49:24 -04:00
Yuxin Wang
e01da09179 Exit when test finishes. 2018-09-30 13:32:07 -04:00
Yuxin Wang
430bb51a21 Upload travis config file. 2018-09-30 11:08:48 -04:00
Yuxin Wang
78d4bbb147 BaseServer handles the close of all connections. 2018-09-30 11:00:44 -04:00
Yuxin Wang
b3eaf0c33c Make is_running protected member. 2018-09-30 11:00:11 -04:00
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