Commit Graph

21 Commits

Author SHA1 Message Date
Mahendra 1a36361ef9
replace all random.xxx with helper random function 2018-03-21 19:26:27 +05:30
Peter Šurda fd1a6c1fa1
Dandelion update
- dandelion fixes
- try to wait as long as possible before expiration if there are no
outbound connections
- expire in invThread rather than singleCleaner thread
- deduplication of code in inv and dinv command methods
- turn on by default, seems to work correctly now
- turn off dandelion if outbound connections are disabled
- start tracking downloads earlier, and faster download loop
- remove some obsolete lines
- minor PEP8 updates
2018-02-03 11:46:39 +01:00
Peter Šurda 053f434e04
Download fixes
- don't make empty requests
- don't make requests if all objects are pending already
2018-02-02 12:44:43 +01:00
Peter Šurda 57c8c7c07c
Download thread exception handling 2018-02-01 23:18:08 +01:00
Peter Šurda 8498143783
Download fixes
- check if already have object before requesting
2018-02-01 22:58:04 +01:00
Peter Šurda 290b87a49f
Download fixes
- don't expire too quickly
- ignore connections that haven't been fully established yet
2018-02-01 12:48:14 +01:00
Peter Šurda c5dc7fc903
Typo 2018-02-01 12:26:54 +01:00
Peter Šurda 68b58ce0c5
Download optimisation
- new data structure to handle download tracking, uses less CPU
2018-02-01 12:19:39 +01:00
Peter Šurda 36cc5b9cf5
Download optimisations
- don't make empty download requests
- use smaller chunks when they can be spread across multiple
connections
2018-01-01 12:51:35 +01:00
Peter Šurda a3398d6a17
Don't crash download thread if no connections 2017-12-02 00:50:58 +01:00
Peter Šurda 41ead2bfb5
Distribute downloads more evenly
- also increases expireation of missing objects from 10 minutes to an
hour
2017-12-02 00:48:08 +01:00
Peter Šurda 1e02d2b48a
Download optimisation
- pending download tracking now per-connection instead of globally
2017-11-17 19:49:51 +01:00
Peter Šurda 4b40d4bce1
Download thread error handling 2017-10-22 15:28:30 +02:00
Peter Šurda 75a6f605c1
Download optimisation
- more accurate tracking
- randomise download order
- longer cycle
2017-10-22 11:32:37 +02:00
Peter Šurda 4c9006a632
Asyncore performance optimisation
- use bytearray instead of strings for buffers
2017-10-16 08:07:32 +02:00
Peter Šurda f088e0ae21
Change thread names
- not needed to have "Thread" in the name of a thread
2017-07-10 07:05:50 +02:00
Peter Šurda 2d7d9c2f92
Asyncore update
- request downloads in bigger chunks
- don't put whole objects into the receiveDataQueue
2017-07-08 06:54:25 +02:00
Peter Šurda ba4162d7fe
Asyncore update
- get rid of per-connection writeQueue/receiveQueue, and instead use
strings and locking
- minor code cleanup
- all state handlers now should set expectBytes
- almost all data processing happens in ReceiveDataThread, and
AsyncoreThread is almost only I/O (plus TLS). AsyncoreThread simply
puts the connection object into the queue when it has some data for
processing
- allow poll, epoll and kqueue handlers. kqueue is untested and
unoptimised, poll and epoll seem to work ok (linux)
- stack depth threshold handler  in decode_payload_content, this is
recursive and I think was causing occasional RuntimeErrors. Fixes #964
- longer asyncore loops, as now data is handled in ReceiveDataThread
- randomise node order when deciding what to download. Should prevent
retries being stuck to the same node
- socks cleanup (socks5 works ok, socks4a untested but should work too)
2017-07-06 19:45:36 +02:00
Peter Šurda fc19e4119a
Download thread updates
- now tracks downloads globally too, so it doesn't request the same
object from multiple peers at the same time
- retries at the earliest every minute
- stops trying to download an object after an hour
- minor fixes in retrying downloading invalid objects
2017-07-05 09:25:49 +02:00
Peter Šurda 2685fe29b1
Code quality improvements 2017-06-24 12:13:35 +02:00
Peter Šurda 0cc8589b27
Asyncore updates
- should prevent the same object being re-requested indefinitely
- locking for object tracking
- move SSL-specific error handling to TLSDispatcher
- observe maximum connection limit when accepting a new connection
- stack depth test (for debugging purposes)
- separate download thread
- connection pool init moved to main thread
2017-06-21 12:16:33 +02:00