Commit graph

179 commits

Author SHA1 Message Date
Yuxin Wang
65e6fe1dab Update the server address after started. 2018-10-06 23:12:24 -04:00
Yuxin Wang
d2192ae232 Rename variable to _server_address to make it clear. 2018-10-06 23:02:16 -04:00
Yuxin Wang
e6c55193f2 Rename variable from _server_* to _tracker_* to avoid confusion. 2018-10-06 23:02:03 -04:00
Yuxin Wang
c89a59d7b1 Only print message body. 2018-10-06 22:54:41 -04:00
Yuxin Wang
31aace2c58 Use _message_log to print message. 2018-10-06 22:53:03 -04:00
Yuxin Wang
3f579fc25e Add new connection log. 2018-10-06 22:52:02 -04:00
Yuxin Wang
1db203575f Fix peers dict iterations bug. 2018-10-06 22:51:52 -04:00
Yuxin Wang
c4dbe9c5cc Make __message_log method protected to be used by subclassees. 2018-10-06 22:51:24 -04:00
Yuxin Wang
4853c73e53 Write REPLY_REGISTER message back to peer. 2018-10-06 22:46:57 -04:00
Yuxin Wang
1d2cdfb01e Convert Enum to IntValue. 2018-10-06 22:39:33 -04:00
Yuxin Wang
ae937aa48b Fix the order of argument. 2018-10-06 22:39:23 -04:00
Yuxin Wang
a651c7e0db Remove unnecessary import. 2018-10-06 22:34:44 -04:00
Yuxin Wang
8db58b4441 Make the tests asynchronous. 2018-10-06 14:18:23 -04:00
Yuxin Wang
e2f68790b7 Make Peer asynchrounous. 2018-10-06 14:18:15 -04:00
Yuxin Wang
2d71e1581d Refactor test_server_refused with asyncio. 2018-10-06 11:01:03 -04:00
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