Commit graph

164 commits

Author SHA1 Message Date
Yuxin Wang
de0ae932de Rename type variable to avoid builtin name collision. 2018-10-06 11:00:13 -04:00
Yuxin Wang
6437d9de41 Return True when server is started. 2018-10-06 10:32:01 -04:00
Yuxin Wang
f72e9bf17d Use a tuple to store host and port. 2018-10-06 10:28:15 -04:00
Yuxin Wang
b9a4fb0876 Use of 'auto' is only supported since python 3.6 2018-10-06 10:20:53 -04:00
Yuxin Wang
09d7e39d9c Simplify tracker based on MessageServer and asyncio. 2018-10-06 09:52:22 -04:00
Yuxin Wang
d13152b927 Merge MessageType with server module. 2018-10-05 23:25:59 -04:00
Yuxin Wang
bd5e2ab677 Add uvloop/asynccmd requirement. 2018-10-05 23:22:02 -04:00
Yuxin Wang
f3f1d928e8 Remove writer after _process_connection. 2018-10-05 23:21:47 -04:00
Yuxin Wang
604464c87f Simplify the base server with the asyncio. 2018-10-05 18:08:16 -04:00
Yuxin Wang
49cd3f5a35 Use Enum class to represent message types. 2018-10-05 17:15:00 -04:00
Yuxin Wang
fe646894b4 Drop python 3.4 support.
async and await syntaxes are introduced since python 3.5
2018-10-04 15:42:47 -04:00
Yuxin Wang
28ea3086dd Use tqdm as the progressbar. 2018-10-04 00:17:26 -04:00
Yuxin Wang
fe18541299 Set socket blocking for send operations. 2018-10-04 00:04:50 -04:00
Yuxin Wang
13ba10c595 Add test for reporthook. 2018-10-04 00:01:22 -04:00
Yuxin Wang
f5f3335819 Add do_list_peers for tracker. 2018-10-04 00:01:07 -04:00
Yuxin Wang
9308d01638 Check file existence before doing the actual work. 2018-10-03 23:23:56 -04:00
Yuxin Wang
0c8db5cf68 Use urlretrive style reporthook. 2018-10-03 22:59:55 -04:00
Yuxin Wang
e801517fda Make _hashfunc a class member. 2018-10-03 22:44:42 -04:00
Yuxin Wang
7d71241b7f Make CHUNKSIZE protected. 2018-10-03 22:44:24 -04:00
Yuxin Wang
7bd7baf897 Remove wrong code. 2018-10-03 22:43:29 -04:00
Yuxin Wang
1a66e36374 Fix typo. 2018-10-03 17:10:21 -04:00
Yuxin Wang
5d90c2ec40 Remove list_peers command. 2018-10-03 16:29:21 -04:00
Yuxin Wang
b161dd00b0 Compute digest on raw data instead of base64 encoded data. 2018-10-02 23:50:07 -04:00
Yuxin Wang
0cdf383899 Add digest to chunk communications. 2018-10-02 21:23:09 -04:00
Yuxin Wang
d389ec57ad Remove duplicate code. 2018-10-02 00:17:31 -04:00
Yuxin Wang
47748561a7 Add badges. 2018-10-01 23:57:19 -04:00
Yuxin Wang
4190742c49 Merge branch 'no-peer-connection-on-start' 2018-10-01 23:55:23 -04:00
Yuxin Wang
f66ba78999 Close the socket after calling _client_closed.
Subclass might use the client's information.
2018-10-01 23:55:02 -04:00
Yuxin Wang
d6a66bb1f7 Move closed error warning into subclasses. 2018-10-01 23:54:01 -04:00
Yuxin Wang
439ed70c6f Stringfy the peer address.
JSON requires that the keys in dict must be strings.
2018-10-01 23:33:03 -04:00
Yuxin Wang
5345ac37e1 Move finally block to the end. 2018-10-01 23:32:06 -04:00
Yuxin Wang
55dde948a9 No need to iterate address. 2018-10-01 22:46:45 -04:00
Yuxin Wang
3cd897ab0f Remove dead code. 2018-10-01 22:46:33 -04:00
Yuxin Wang
441a8fd11a Move the position of the method. 2018-10-01 22:46:26 -04:00
Yuxin Wang
854d1676bb Return boolean value for start method. 2018-10-01 22:30:46 -04:00
Yuxin Wang
97b2a34bef Connect to peers when downloading. 2018-10-01 22:20:04 -04:00
Yuxin Wang
eb3f5c99ae Store peer address instead of IDs. 2018-10-01 22:19:44 -04:00
Yuxin Wang
69c134f96d Use address tuple instead of separate (ip, port). 2018-10-01 22:18:48 -04:00
Yuxin Wang
70136b99c1 Remove log for peers member. 2018-10-01 22:01:18 -04:00
Yuxin Wang
cd89348b1b Simplify REQUEST_REGISTER.
Don't have to know the peer_list when register, only acquire when downloading.
2018-10-01 21:56:36 -04:00
Yuxin Wang
a755f21fd1 Remove peers member.
We don't have to maintain the list of peers since we only connect when needed.
2018-10-01 21:53:07 -04:00
Yuxin Wang
f5776ed9cd Remove _server_started signal. 2018-10-01 21:52:24 -04:00
Yuxin Wang
488987a326 Return True/False for start method. 2018-10-01 21:47:53 -04:00
Yuxin Wang
5fb1142862 Remove PEER_GREET message. 2018-10-01 21:40:36 -04:00
Yuxin Wang
4819f1fb0b Copy a set to prevent changes of set's size. 2018-10-01 20:45:53 -04:00
Yuxin Wang
90095353a2 Add timeout for server socket.
socket.accept() now will timeout in _listen method.
2018-10-01 20:16:00 -04:00
Yuxin Wang
8931aee7d2 Use pip to install codecov. 2018-10-01 16:54:21 -04:00
Yuxin Wang
ca44603284 Manage the threads. 2018-10-01 16:16:10 -04:00
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