Comments (4)
Oh dear, this looks non-trivial.
from torrent.
The first fix was bogus, see the later commit. Let me know how it goes.
from torrent.
Nice fix.
Do you think transaction.userOnResponse()
should be called even if the query fails? Or was it just the easiest fix you thought about?
It seems to me that when the ping fails, userOnResponse()
is called by transaction.close()
which is called a couple of times (!) by transaction.timeout()
which is called by transaction.timerCallback()
the timer for which is assigned by transaction.startTimer()
which is assigned by jitterDuration
... this stuff looks pretty convoluted.
What was the logic there? What is the purpose of jitterDuration
?
from torrent.
I don't actually recall why it works like that, I think it kind of evolved that way. I don't like how complex the response handling is, but it seemed justified at the time.
If you can think of a clearer way, I welcome it. It mainly went this path due to a need to reduce the number of goroutines. When I first wrote the DHT package, the server could easily jump to 200k goroutines, which wasn't compatible with the race detector.
jitterDuration implements slightly randomized timeouts, this is common in many network protocols to reduce the chance of network storms. That is, if a bunch of timeouts all trigger at the same time, a lot of outbound packets are sent too quickly. This occurs when you write a lot of packets over something like UDP, and then set identical timeouts to resend them all.
from torrent.
Related Issues (20)
- undefined: sync.OnceFunc HOT 7
- Support passing context to `torrent.Reader` HOT 1
- How to config DHT listen port? HOT 4
- Add global semaphore to limit amount of pieceHashers
- Problem getting magnet metadata on large files HOT 6
- Client requests indefinitely on storage write errors HOT 42
- More than 3 times slow download speed over sqllite storage HOT 9
- Prioritize the use of local peers HOT 1
- Slow downloads while multiple large torrents are being downloaded. HOT 25
- panic: net/http: internal error: connCount underflow HOT 9
- listen tcp6 :42069: socket: address family not supported by protocol HOT 3
- ICE Servers config doesn't support authentication for TURN servers HOT 1
- hign cpu usage of sha1.blockAMD64 HOT 8
- Cannot download file from a not completed peer HOT 5
- Can't build [email protected] with go1.20 HOT 2
- Cannot use download subcmd to download what i seed torrent HOT 6
- Ignore malformed (optional) fields in metainfo.Load
- ratelimireader.go panic HOT 2
- Does repo support to build private dht bootstrap server? HOT 1
- Error tracking HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent.