Comments (4)
To clarify, the Decode function does fill the outmost dictionary fields, but not the inner one.
Also, encoding that object works - just decoding won't work.
from taipei-torrent.
Hey, sorry to cause you trouble.
If the torrent protocol doesn't require decoding dictionaries inside of dictionaries, I guess that explains why this bug hasn't been found.
As for how to fix it -- it may be a case where an object is being passed by reference rather than by pointer. So we may be successfully decoding the inner dictionary, but then throwing away that copy rather than saving it in the outer dictionary.
That is a wild guess, but I've had similar bugs in the past. It is error-prone that interface{} works for both references and pointers.
from taipei-torrent.
Hey, thanks for the reply.
This is required for DHT. See the sample queries in http://www.bittorrent.org/beps/bep_0005.html.
I'll take a shot at this later, and also try to fix a few panics conditions that I managed to generate when doing incorrect calls (e.g: when I inappropriately passed map[string]string{} for a decoding that demanded map[string]interface{}, IIRC).
Another question, would it be too ugly for me to add a safety measure in the bencode library, so it catches all panics before it goes up the stack, so we can show an error instead? That is, only to provide a safety net for really exceptional cases, assuming we can't avoid all panic occurrences in the first place.
from taipei-torrent.
Problem solved. User error, of course. Dictionary inside dictionaries work, I was just doing the wrong thing.
commit b9b781b on my repository adds a unit test for it.
from taipei-torrent.
Related Issues (20)
- How do I get list of peers for a given swarm? HOT 7
- Feature Request: Support WebTorrent HOT 1
- Leachers seem to prefer seeders, is that correct behavior? HOT 3
- "Rejecting peer because already have a peer with the same id" after node restart HOT 2
- Killed process can leave corrupted resume file.
- Torrent session not properly torn-down on loading error.
- This project does not implement "rarest first" algorithm
- Usually have "send a bad piece" error HOT 1
- have it implementation bep_0009? HOT 1
- sorry for a problem
- need help!!!
- add http stream Features pls
- Integration with blockchain (tendermint) HOT 1
- keepalived msg, empty msg, also read msg len: 1, why do this? HOT 6
- Data race
- Torrent file created from magnet link can't be loaded.
- Compartmentalization/files API simplification HOT 3
- Incorrect download size reported after client-side restart during the download process
- install error HOT 1
- Skip files
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 taipei-torrent.