Fix "Failed reading packet!" #16
This commit is contained in:
parent
cdb2437161
commit
2b40b47992
|
@ -1,4 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import struct
|
||||||
|
|
||||||
from librespot.common import Utils
|
from librespot.common import Utils
|
||||||
from librespot.core import Session
|
from librespot.core import Session
|
||||||
from librespot.core.PacketsReceiver import PacketsReceiver
|
from librespot.core.PacketsReceiver import PacketsReceiver
|
||||||
|
@ -34,7 +37,7 @@ class AudioKeyManager(PacketsReceiver):
|
||||||
out = ByteArrayOutputStream()
|
out = ByteArrayOutputStream()
|
||||||
out.write(buffer=bytearray(file_id))
|
out.write(buffer=bytearray(file_id))
|
||||||
out.write(buffer=bytearray(gid))
|
out.write(buffer=bytearray(gid))
|
||||||
out.write(buffer=bytearray(Utils.to_byte_array(seq)))
|
out.write(buffer=bytearray(struct.pack(">i", seq)))
|
||||||
out.write(buffer=bytearray(self._ZERO_SHORT))
|
out.write(buffer=bytearray(self._ZERO_SHORT))
|
||||||
|
|
||||||
self._session.send(Packet.Type.request_key, out.to_bytes())
|
self._session.send(Packet.Type.request_key, out.to_bytes())
|
||||||
|
|
|
@ -852,7 +852,7 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
|
||||||
|
|
||||||
class SpotifyAuthenticationException(Exception):
|
class SpotifyAuthenticationException(Exception):
|
||||||
def __init__(self, login_failed: Keyexchange.APLoginFailed):
|
def __init__(self, login_failed: Keyexchange.APLoginFailed):
|
||||||
super().__init__(login_failed.error_code.name)
|
super().__init__(Keyexchange.ErrorCode.Name(login_failed.error_code))
|
||||||
|
|
||||||
class Accumulator:
|
class Accumulator:
|
||||||
buffer: bytes = bytes()
|
buffer: bytes = bytes()
|
||||||
|
@ -974,12 +974,11 @@ class Session(Closeable, SubListener, DealerClient.MessageListener):
|
||||||
self.session._LOGGER.fatal(
|
self.session._LOGGER.fatal(
|
||||||
"Failed reading packet! {}".format(ex))
|
"Failed reading packet! {}".format(ex))
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
self.session._reconnect()
|
# self.session._reconnect()
|
||||||
break
|
break
|
||||||
|
|
||||||
if not self.running:
|
if not self.running:
|
||||||
break
|
break
|
||||||
|
|
||||||
if cmd == Packet.Type.ping:
|
if cmd == Packet.Type.ping:
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
if self.session._scheduledReconnect is not None:
|
if self.session._scheduledReconnect is not None:
|
||||||
|
|
Loading…
Reference in New Issue