WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 3886417

Browse files
committed
Fix logic and upgrade client connection version when mismatch occurs.
1 parent 480a218 commit 3886417

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "simplyprint-ws-client"
3-
version = "1.0.1rc39"
3+
version = "1.0.1rc40"
44
description = "SimplyPrint Websocket Client"
55
authors = [{ name = "SimplyPrint", email = "[email protected]" }]
66
requires-python = ">=3.9"

simplyprint_ws_client/core/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,18 @@ def consume(self):
370370

371371
@configure(ConnectionIncomingEvent)
372372
async def _on_connection_incoming(self, msg: ServerMsgKind, v: int):
373-
if self.v < v:
373+
if self.v > v:
374374
self.logger.warning("Dropped incoming message %s with v: %d.", msg, v)
375375
return
376376

377+
if self.v != v:
378+
self.v = v
379+
self.logger.warning(
380+
"Upgraded client connection version from %d to %d due to new message.",
381+
self.v,
382+
v,
383+
)
384+
377385
if msg.type == ServerMsgType.DEMAND:
378386
await self.event_bus.emit(msg.data.demand, msg.data)
379387
else:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)