drifTech-lib 0.2.5__tar.gz → 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of drifTech-lib might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drifTech-lib
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: Common files/functions across most drifTech software
5
5
  Author: driftbluestone
6
6
  Author-email: driftbluestone <driftbluestone@gmail.com>
@@ -8,7 +8,7 @@ build-backend = "uv_build"
8
8
 
9
9
  [project]
10
10
  name = "drifTech-lib"
11
- version = "0.2.5"
11
+ version = "0.2.6"
12
12
  description = "Common files/functions across most drifTech software"
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.14"
@@ -8,7 +8,7 @@ build-backend = "uv_build"
8
8
 
9
9
  [project]
10
10
  name = "drifTech-lib"
11
- version = "0.2.5"
11
+ version = "0.2.6"
12
12
  authors = [{name = "driftbluestone", email = "driftbluestone@gmail.com"}]
13
13
  description = "Common files/functions across most drifTech software"
14
14
  readme = "README.md"
@@ -2,7 +2,9 @@ import asyncio, logging
2
2
  logger = logging.getLogger("ipc:server")
3
3
  __all__ = ["start"]
4
4
 
5
- async def start(HOST, PORT):
5
+ open_connections = 1
6
+
7
+ async def start(HOST = "127.0.0.1", PORT = 8000):
6
8
  server = await asyncio.start_server(interface, HOST, PORT)
7
9
  logger.info(f"[LISTENING] Server is running on {HOST}:{PORT}")
8
10
  async with server:
@@ -10,7 +12,8 @@ async def start(HOST, PORT):
10
12
 
11
13
  async def interface(reader: asyncio.StreamReader, writer: asyncio.StreamWriter):
12
14
  addr = writer.get_extra_info("peername")
13
- logger.info(f"[CONNECTION]: Connection opened for {addr}")
15
+ logger.info(f"[CONNECTION] Connection opened for {addr} #{open_connections}")
16
+ open_connections += 1
14
17
  try:
15
18
  while True:
16
19
  data = await reader.read(1024)
@@ -20,10 +23,12 @@ async def interface(reader: asyncio.StreamReader, writer: asyncio.StreamWriter):
20
23
  writer.write(b"Message processed")
21
24
  await writer.drain() # Ensure data is flushed to the network buffer
22
25
  except (asyncio.CancelledError, ConnectionResetError, BrokenPipeError, OSError):
23
- logger.info(f"[DISCONNECTED] Connection closed for {addr}")
26
+ open_connections -= 1
27
+ logger.info(f"[DISCONNECTED] Connection closed for {addr} #{open_connections-1}")
24
28
  writer.close()
25
29
  await writer.wait_closed()
26
30
  finally:
27
- logger.info(f"[DISCONNECTED] Connection closed for {addr}")
31
+ open_connections -= 1
32
+ logger.info(f"[DISCONNECTED] Connection closed for {addr} #{open_connections-1}")
28
33
  writer.close()
29
34
  await writer.wait_closed()
File without changes
File without changes