mafintosh / mafintosh/utp-native
Better debug options
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 101
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Working on #42 it was very hard to figure out what was happening if something didn't work as expected. For example: one of my theory on #40 is with awkward timing, a connection may be closed just when fin-ack [is sent](https://github.com/bittorrent/libutp/blob/master/utp_internal.cpp#L2181), which may mean `utp_call_on_state_change` may never be executed, causing utp-native to wait until timeout until closed.
The reason why I came this far is because I enabled `libutp`'s debug mode and added a _lot_ of print statements to the bindings, as well as adding an identifier to the connection so I could make sure in the log statements _what_ operation caused a problem.
Adding/Removing the log statements to find the cause of an error is stressful. Which is why I would like to propose to add debug support to the library itself so debugging can be easier.
- Add an incrementing number to the `utp` and `connection` instances that is passed-on to the bindings which allows to figure out _which_ connection is doing what in a command line.
- Add debug statements to the Bindings that can be activated with a `UTP_DEBUG_LOGGING` compile time option.
- Add [`debug`](https://github.com/visionmedia/debug) statements to the Connection and UTP classes that also let know what happens when.
- (Optional) Add debug builds of the binaries and load the debug builds if the `debug.enabled` is true instead of the production binaries.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failure path around utp_internal.cpp line 2181 and inspect the bindings plus the UTP and Connection classes. Trace how connection state changes reach the bindings, then define the debug logging and connection identifiers across those layers. Done means the requested compile-time bindings logging and class-level debug output are available, with optional debug binaries assessed separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100