Skip to content

Commit

Permalink
Fix the new websocket library from sending stupid ping packets that t…
Browse files Browse the repository at this point in the history
…he rust+ server doesn't handle
  • Loading branch information
olijeffers0n committed Jun 5, 2023
1 parent 678eb8d commit c37fa8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rustplus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@

__name__ = "rustplus"
__author__ = "olijeffers0n"
__version__ = "5.6.3"
__version__ = "5.6.4"
__support__ = "Discord: https://discord.gg/nQqJe8qvP8"
3 changes: 3 additions & 0 deletions rustplus/api/base_rust_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ def command(
if isinstance(coro, RegisteredListener):
coro = coro.get_coro()

if self.remote.command_handler is None:
raise CommandsNotEnabledError("Not enabled")

if asyncio.iscoroutinefunction(coro):
cmd_data = CommandData(
coro,
Expand Down
7 changes: 4 additions & 3 deletions rustplus/api/remote/rustws.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def connect(
)
)
address += f"?v={str(self.magic_value)}"
self.connection = await connect(address, close_timeout=0)
self.connection = await connect(address, close_timeout=0, ping_interval=None)
self.connected_time = time.time()
break
except Exception as exception:
Expand Down Expand Up @@ -155,9 +155,10 @@ async def run(self) -> None:
base64.b64decode(data) if self.use_test_server else data
)

except Exception:
except Exception as e:
if self.connection_status == CONNECTED:
self.logger.warning(
print(e)
self.logger.exception(
f"{datetime.now().strftime('%d/%m/%Y %H:%M:%S')} [RustPlus.py] Connection interrupted, Retrying"
)
await self.connect(ignore_open_value=True)
Expand Down

0 comments on commit c37fa8a

Please sign in to comment.