Commit graph

86 commits

Author SHA1 Message Date
Joakim Frostegård
352f571c42 Decide to use Apache 2.0 license, add file and update Cargo.toml's 2020-04-20 16:54:43 +02:00
Joakim Frostegård
7ba61ee6b7 aquatic: improve comment for NetworkConfig.socket_recv_buffer_size 2020-04-19 10:34:01 +02:00
Joakim Frostegård
4127cbc7c9 aquatic: handlers: minor syntax and comment improvements 2020-04-14 20:13:12 +02:00
Joakim Frostegård
6fca5cd9d5 aquatic: config: resort to default values for keys not present in file 2020-04-14 17:45:35 +02:00
Joakim Frostegård
f0ec858bef socket workers: add Vec for requests (send together) and responses
Local response vector is used for error responses
2020-04-13 17:13:03 +02:00
Joakim Frostegård
6950726b3c aquatic: actually send error responses from parsing 2020-04-13 16:52:05 +02:00
Joakim Frostegård
c44c5b017f aquatic: announce: fix bug in calculation of number of peers to take 2020-04-13 12:52:58 +02:00
Joakim Frostegård
8f68b3a9a2 aquatic: config: change default settings 2020-04-13 12:50:53 +02:00
Joakim Frostegård
ca52b44389 split connection and torrent mutexes again 2020-04-13 12:01:17 +02:00
Joakim Frostegård
06ff4ad9d0 aquatic: save valid_until Instant in connections and requests
Hopefully prevents strange subtraction overflow error, but
we'll see.
2020-04-12 22:04:42 +02:00
Joakim Frostegård
587096f76f aquatic: give threads names when spawning them 2020-04-12 21:46:48 +02:00
Joakim Frostegård
140aa4b75d aquatic: improve naming of socket workers, request workers 2020-04-12 21:40:38 +02:00
Joakim Frostegård
f8713c09c1 aquatic: handler: put responses in vector, send after releasing lock 2020-04-12 14:54:38 +02:00
Joakim Frostegård
2779b6ec3a aquatic: lock connections and torrents together; optimize handler
Handler: don't stop collecting requests early unless mutex can
be unlocked.
2020-04-12 14:44:34 +02:00
Joakim Frostegård
cbae43e175 aquatic: HandlerConfig: add comment 2020-04-12 13:31:32 +02:00
Joakim Frostegård
ad7a8c46a9 aquatic: config: rename recv_buffer_size to socket_recv_buffer_size 2020-04-12 13:29:21 +02:00
Joakim Frostegård
5430e561f5 aquatic: Config: add fields for max handler request, channel timeout 2020-04-12 13:26:44 +02:00
Joakim Frostegård
e61c961126 Use hashbrown hashmap directly for faster hash (ahash) 2020-04-12 13:19:07 +02:00
Joakim Frostegård
558ddadf28 Remove DashMap, use parking_lot::Mutex<HashMap> instead 2020-04-11 22:07:09 +02:00
Joakim Frostegård
70cc193522 Use crossbeam channel insteaf of SegQueue
Reduces overutilization of CPU greatly
2020-04-11 21:11:25 +02:00
Joakim Frostegård
f37ba1e52e Use (unbounded) SegQueue instead of ArrayQueue 2020-04-11 20:00:51 +02:00
Joakim Frostegård
3527952242 start work on using seperate threads for sockets and handlers 2020-04-11 19:35:15 +02:00
Joakim Frostegård
9bf17b0ab4 bittorrent_udp: response_to_bytes: return Result<(), io:Error> 2020-04-11 15:03:50 +02:00
Joakim Frostegård
834a8c3fa2 cli_helpers: run_with_cli_and_config: rename function and "f" argument 2020-04-11 14:19:46 +02:00
Joakim Frostegård
688372bdf2 aquatic: announce and scrape handlers: send back error on invalid conn 2020-04-11 14:17:03 +02:00
Joakim Frostegård
fe85901021 bittorrent_udp: add RequestParseError; remove InvalidRequest; other fixes 2020-04-10 15:16:20 +02:00
Joakim Frostegård
8dfd49af0d cli helpers: in run function, take function as argument instead 2020-04-09 17:56:20 +02:00
Joakim Frostegård
ac52668a3d add crate cli_helpers with option and config parsing; use in aquatic
Putting cli functionality into its own crate will allow using it
from aquatic_bench and possibly other programs.
2020-04-09 16:55:40 +02:00
Joakim Frostegård
b457df26e3 aquatic annonunce handler: downgrade TorrentMap ref instead of new .get 2020-04-09 11:46:06 +02:00
Joakim Frostegård
32edee9bbb aquatic: add #[inline] to handle_readable_socket and handlers
Also update aquatic_bench comment with new bench results
2020-04-09 10:14:53 +02:00
Joakim Frostegård
2fd732efc6 aquatic: handlers: pass rng's as function arguments 2020-04-09 09:53:18 +02:00
Joakim Frostegård
bd16cdd709 aquatic: event loop: don't preallocate request/response vectors
It's better to just allocate when needed.
2020-04-09 09:34:39 +02:00
Joakim Frostegård
eddd353621 aquatic: when statistics.interval == 0, skip adding to stats atomics 2020-04-08 22:00:52 +02:00
Joakim Frostegård
5d2e4412b3 aquatic: create function in tasks.rs for statistics printing 2020-04-08 21:55:16 +02:00
Joakim Frostegård
58fbf8b7fe aquatic: add comments to many config fields 2020-04-08 21:50:23 +02:00
Joakim Frostegård
e3b29723a4 aquatic: when config recv_buffer_size is zero, don't set on socket 2020-04-08 21:45:25 +02:00
Joakim Frostegård
ad68dda9f5 aquatic: remove unnecessary fields from Peer; general clean up 2020-04-08 21:40:36 +02:00
Joakim Frostegård
31c8864658 aquatic: put max_scrape_torrents, max_response_peers in NetworkConfig 2020-04-08 21:32:05 +02:00
Joakim Frostegård
7239e9c047 aquatic: add and use NetworkConfig.peer_announce_interval 2020-04-08 21:30:57 +02:00
Joakim Frostegård
ca9d15c7a9 aquatic: move some fields from Config into new NetworkConfig 2020-04-08 21:27:12 +02:00
Joakim Frostegård
fa60eddcc4 aquatic: add CleaningConfig and StatisticsConfig to Config, use them 2020-04-08 21:22:45 +02:00
Joakim Frostegård
766606cc08 aquatic: announce handler: improve safety by small margin 2020-04-08 20:26:39 +02:00
Joakim Frostegård
789783cfe4 aquatic scrape handler: preallocate stats vec better 2020-04-08 20:23:31 +02:00
Joakim Frostegård
910accad31 announce handler: keep mutable access to torrent map less time 2020-04-08 13:32:18 +02:00
Joakim Frostegård
afa4ad318f aquatic stats print: fix newline printing issue 2020-04-08 11:56:30 +02:00
Joakim Frostegård
d896b6cf29 aquatic: print entire socket errors 2020-04-08 11:49:47 +02:00
Joakim Frostegård
52078ab1ad aquatic: print bandwidth used (based on bytes received and sent) 2020-04-08 11:43:18 +02:00
Joakim Frostegård
a865f4a1ae Add inline markers; simplify ip address conversion in request_from_bytes 2020-04-08 11:21:00 +02:00
Joakim Frostegård
a99688a5a2 benchmark byte conversion as well; bittorrent_udp: use buffers 2020-04-07 20:19:28 +02:00
Joakim Frostegård
51590a3d6c aquatic: print stats about number of peers per torrent 2020-04-07 16:57:34 +02:00