Skip to content

Commit

Permalink
version: gamium 2.0.5. fix python close error on testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yowpark committed Aug 4, 2023
1 parent 9b2c2d5 commit 4a222c8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions client/python/gamium/gamium/tcp_gamium_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def connect(self, try_count: int = 30) -> HelloResultT:
raise Exception(f"Failed to connect to {self._host}:{self._port}")

def disconnect(self):
self._socket.close()
self._is_connected = False
self._socket.close()

def request(self, packet: PacketTypes[P, R], timeout_ms: int = 0) -> R:
if 0 == timeout_ms:
Expand All @@ -81,19 +81,22 @@ def request(self, packet: PacketTypes[P, R], timeout_ms: int = 0) -> R:
self._socket.sendall(builder.Output())
except socket.error as e:
self._logger.error(f"Failed to send request: {e}")
self.disconnect()
raise e

try:
while True:
data = self._socket.recv(1024)
if len(data) == 0:
self.disconnect()
self._recv_queue.pushBuffer(data)
if self._recv_queue.has():
break
return self.pop_message(req)

except Exception as e:
self._logger.error(f"Failed to receive response: {e}")
except ConnectionResetError:
self.disconnect()
except Exception as e:
raise e

return data
Expand Down
2 changes: 1 addition & 1 deletion client/python/gamium/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gamium"
version = "2.0.4"
version = "2.0.5"
description = ""
authors = ["dogu"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion client/typescript/gamium/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gamium",
"version": "2.0.4",
"version": "2.0.5",
"description": "Gamium is an SDK that allows you to automate gameplay",
"license": "MIT",
"author": "dogu",
Expand Down
2 changes: 1 addition & 1 deletion engine/unity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.dogu.gamium.engine.unity",
"version": "2.0.3",
"version": "2.0.5",
"description": "gamium unity server package",
"license": "MIT",
"author": "gamium",
Expand Down

0 comments on commit 4a222c8

Please sign in to comment.