Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit more warnings in the client instance (http errors, tracker connection errors...) #960

Closed
Chocobozzz opened this issue Oct 23, 2016 · 6 comments

Comments

@Chocobozzz
Copy link
Contributor

@Chocobozzz Chocobozzz commented Oct 23, 2016

Hi,

If a tracker is down and the client wants to connect through a websocket, the connection will fail but we don't have any warnings events in the client instance. It could be useful for certain applications to notify their users for example.

In another case, we don't have warnings if the client cannot fetch the torrent file from the xs parameter (just debug console logs: https://github.com/feross/webtorrent/blob/master/lib/torrent.js#L415). This could be a precious information if the application relies actively on webseed.

Thanks :)

WebTorrent version: 0.96.5
Browser: Chromium 53

@gpetrov

This comment has been minimized.

Copy link
Contributor

@gpetrov gpetrov commented Nov 4, 2016

yes please do - currently our webseeds got stuck and we have no idea why. More debugging will be really helpful

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 19, 2017

@gpetrov The webseed stuck issue is fixed in the latest version. See PR #972

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 19, 2017

@Chocobozzz If a tracker is down and the client wants to connect through a websocket, the connection will fail but we don't have any warnings events in the client instance. It could be useful for certain applications to notify their users for example.

You're right. This would be useful to have! Actually, there is already code in place that calls torrent.emit('warning', err) whenever there is an error connecting to a tracker. But there's a small bug in simple-websocket (or bittorrent-tracker, depending on how you look at it) that is suppressing the error. PR here: feross/simple-websocket#14

When we emit 'close' then 'error', the problem is that bittorrent-tracker as the user of the stream calls removeEventListener() on the 'close' and 'error' handlers it attached, to clean things up. But since 'close' fires first, it cleans up the 'error' handler and we don't ever get the error.

This is now fixed!

feross added a commit that referenced this issue Jan 19, 2017
Convert some debug statements that could be useful for an API user
(either because they want to show to the user, or to react to the
warning in some way)

Fixes #960
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 19, 2017

@Chocobozzz In another case, we don't have warnings if the client cannot fetch the torrent file from the xs parameter

That's a good point. PR here: #1021

@Chocobozzz

This comment has been minimized.

Copy link
Contributor Author

@Chocobozzz Chocobozzz commented Jan 19, 2017

Awesome, thanks @feross!

@feross feross closed this in #1021 Jan 19, 2017
@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.