mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 16:25:36 +00:00
Fix alive
This commit is contained in:
parent
84830f9b7c
commit
5ab9295a9d
@ -33,14 +33,15 @@ class Client:
|
|||||||
def is_disconnected(self):
|
def is_disconnected(self):
|
||||||
if not self.alive:
|
if not self.alive:
|
||||||
return True
|
return True
|
||||||
try:
|
res = self.writer.is_closing()
|
||||||
keep_alive = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE)
|
if res:
|
||||||
if keep_alive:
|
self.log.debug(f"Client Disconnected")
|
||||||
return False
|
self.alive = False
|
||||||
except OSError:
|
return True
|
||||||
pass
|
else:
|
||||||
self.alive = False
|
self.log.debug(f"Client Alive")
|
||||||
return True
|
self.alive = True
|
||||||
|
return False
|
||||||
|
|
||||||
async def kick(self, reason):
|
async def kick(self, reason):
|
||||||
self.log.info(f"Client: \"IP: {self.addr!r}; ID: {self.cid}\" - kicked with reason: \"{reason}\"")
|
self.log.info(f"Client: \"IP: {self.addr!r}; ID: {self.cid}\" - kicked with reason: \"{reason}\"")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user