Commit graph

306 commits

Author SHA1 Message Date
Yuxin Wang
be23ce47f9 Add notes for peers variable. 2018-10-08 11:28:02 -04:00
Yuxin Wang
ae6330cafa Unpack the list to arguments. 2018-10-08 10:41:25 -04:00
Yuxin Wang
ea33442949 asyncio.gather needs ordered data structure. 2018-10-08 10:34:39 -04:00
Yuxin Wang
1c87df92c0 Add try except to catch KeyboardInterrupt. 2018-10-07 23:29:25 -04:00
Yuxin Wang
e1f38dcd76 Add test for downloading from multiple peers. 2018-10-07 23:27:22 -04:00
Yuxin Wang
0651c43da3 Use tuple to represent multiple peers. 2018-10-07 23:19:37 -04:00
Yuxin Wang
d8506c20f6 Schedule request tasks concurrently. 2018-10-07 23:12:09 -04:00
Yuxin Wang
5d2845bcf4 Rename the variable for better readablity. 2018-10-07 22:54:48 -04:00
Yuxin Wang
a800ed03be Merge branch 'use-async-cmd', design a customized async Cmd class. 2018-10-07 22:46:50 -04:00
Yuxin Wang
e6a4b90022 Use bold font for prompt. 2018-10-07 22:46:40 -04:00
Yuxin Wang
2194175d95 Run the async cmdloop. 2018-10-07 22:13:26 -04:00
Yuxin Wang
3315413087 Make Terminal class asynchrounous. 2018-10-07 22:12:35 -04:00
Yuxin Wang
2cc0a2f756 Design an asynchrounous Cmd class. 2018-10-07 22:12:18 -04:00
Yuxin Wang
27cb06aa17 Add aioconsole for ainput method. 2018-10-07 22:11:53 -04:00
Yuxin Wang
35007a1dea Use uvloop on main method. 2018-10-07 15:40:56 -04:00
Yuxin Wang
dc6c44c7e3 Change import order to comply with PEP. 2018-10-07 12:23:27 -04:00
Yuxin Wang
a3e57df658 Merge branch 'use-asyncio', adopt asyncio in core package. 2018-10-07 12:18:37 -04:00
Yuxin Wang
4d87399718 Remove log print of thread id. 2018-10-07 12:09:42 -04:00
Yuxin Wang
3ff1d10a41 Reschedule the read message task when it is done. 2018-10-07 12:09:30 -04:00
Yuxin Wang
d76e2bc128 Fix typo. 2018-10-07 12:08:07 -04:00
Yuxin Wang
49bb02bbab Store server varibale to be closed on stop(). 2018-10-07 12:08:01 -04:00
Yuxin Wang
c0fba12bdc Run peer and tracker stop asynchronously. 2018-10-07 12:07:18 -04:00
Yuxin Wang
c822c7588a Build on python 3.7 2018-10-07 10:32:34 -04:00
Yuxin Wang
b7833ef410 Return None if read is incomplete. 2018-10-07 00:09:12 -04:00
Yuxin Wang
581e24b560 Fix peers dict iteration. 2018-10-07 00:08:44 -04:00
Yuxin Wang
0700d168c5 Wait concurrently for better performance. 2018-10-07 00:08:34 -04:00
Yuxin Wang
33ecb26a9c Add notes to peers dict. 2018-10-07 00:07:56 -04:00
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