Make sure errors resulting from connections failing don't make it to the user interface, as they are expected
This commit is contained in:
parent
55dc482a61
commit
7e4f36e8b4
3 changed files with 15 additions and 2 deletions
|
@ -5,6 +5,7 @@ from twisted.python.failure import Failure
|
|||
from zope.interface import implements
|
||||
from lbrynet.core.Error import PriceDisagreementError, DownloadCanceledError, InsufficientFundsError
|
||||
from lbrynet.core.Error import InvalidResponseError, RequestCanceledError, NoResponseError
|
||||
from lbrynet.core.Error import ConnectionClosedBeforeResponseError
|
||||
from lbrynet.core.client.ClientRequest import ClientRequest, ClientBlobRequest
|
||||
from lbrynet.interfaces import IRequestCreator
|
||||
|
||||
|
@ -304,4 +305,8 @@ class BlobRequester(object):
|
|||
peer.update_score(-10.0)
|
||||
else:
|
||||
peer.update_score(-2.0)
|
||||
if reason.check(ConnectionClosedBeforeResponseError):
|
||||
return
|
||||
# Only unexpected errors should be returned, as they are indicative of real problems
|
||||
# and may be shown to the user.
|
||||
return reason
|
|
@ -9,7 +9,7 @@ from lbrynet.lbrylive.LiveBlob import LiveBlobInfo
|
|||
from lbrynet.core.cryptoutils import get_lbry_hash_obj, verify_signature
|
||||
from lbrynet.interfaces import IRequestCreator, IMetadataHandler
|
||||
from lbrynet.core.Error import InsufficientFundsError, InvalidResponseError, RequestCanceledError
|
||||
from lbrynet.core.Error import NoResponseError
|
||||
from lbrynet.core.Error import NoResponseError, ConnectionClosedBeforeResponseError
|
||||
|
||||
|
||||
class LiveStreamMetadataHandler(object):
|
||||
|
@ -339,4 +339,8 @@ class LiveStreamMetadataHandler(object):
|
|||
logging.warning("Crypt stream info finder: a request failed. Reason: %s", reason.getErrorMessage())
|
||||
self._update_local_score(peer, -5.0)
|
||||
peer.update_score(-10.0)
|
||||
if reason.check(ConnectionClosedBeforeResponseError):
|
||||
return
|
||||
# Only unexpected errors should be returned, as they are indicative of real problems
|
||||
# and may be shown to the user.
|
||||
return reason
|
|
@ -2,7 +2,7 @@ from zope.interface import implements
|
|||
from lbrynet.interfaces import IMetadataHandler, IRequestCreator
|
||||
from lbrynet.core.client.ClientRequest import ClientRequest, ClientPaidRequest
|
||||
from lbrynet.core.Error import InsufficientFundsError, InvalidResponseError, RequestCanceledError
|
||||
from lbrynet.core.Error import NoResponseError
|
||||
from lbrynet.core.Error import NoResponseError, ConnectionClosedBeforeResponseError
|
||||
from ValuableBlobInfo import ValuableBlobInfo
|
||||
import datetime
|
||||
import logging
|
||||
|
@ -292,6 +292,10 @@ class BlindMetadataHandler(object):
|
|||
str(request_type), str(reason.getErrorMessage()))
|
||||
self._update_local_score(peer, -10.0)
|
||||
peer.update_score(-5.0)
|
||||
if reason.check(ConnectionClosedBeforeResponseError):
|
||||
return
|
||||
# Only unexpected errors should be returned, as they are indicative of real problems
|
||||
# and may be shown to the user.
|
||||
return reason
|
||||
|
||||
def _search_for_peers(self):
|
||||
|
|
Loading…
Reference in a new issue