fixcore-engine 0.1.4__tar.gz → 0.1.5__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.
- {fixcore_engine-0.1.4/fixcore_engine.egg-info → fixcore_engine-0.1.5}/PKG-INFO +1 -1
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/transport/initiator.py +17 -3
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5/fixcore_engine.egg-info}/PKG-INFO +1 -1
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/pyproject.toml +1 -1
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/LICENSE +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/README.md +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/application.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/gui.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/gui_ui/app.js +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/gui_ui/fixcore_logo.svg +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/gui_ui/index.html +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/gui_ui/style.css +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/log/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/log/base.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/log/factory.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/log/file_log.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/log/screen.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/cracker.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/data_dictionary.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/exceptions.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/field.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/message/message.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/session/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/session/session.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/session/session_id.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/session/session_settings.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/session/state.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/store/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/store/base.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/store/factory.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/store/file_store.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/store/memory.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/transport/__init__.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/transport/acceptor.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore/transport/framer.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore_engine.egg-info/SOURCES.txt +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore_engine.egg-info/dependency_links.txt +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore_engine.egg-info/entry_points.txt +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore_engine.egg-info/requires.txt +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/fixcore_engine.egg-info/top_level.txt +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/setup.cfg +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_cracker.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_data_dictionary.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_file_log.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_file_store.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_framer.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_integration.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_message.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_session.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_session_id.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_store.py +0 -0
- {fixcore_engine-0.1.4 → fixcore_engine-0.1.5}/tests/test_transport.py +0 -0
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
|
+
import logging
|
|
6
7
|
|
|
7
8
|
from fixcore.application import Application
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
8
11
|
from fixcore.log.base import LogFactory
|
|
9
12
|
from fixcore.session.session import Session
|
|
10
13
|
from fixcore.session.session_id import SessionID
|
|
@@ -61,12 +64,14 @@ class SocketInitiator:
|
|
|
61
64
|
"""Launch a connect-loop task for each configured initiator session."""
|
|
62
65
|
self._stop_event.clear()
|
|
63
66
|
self._no_reconnect.clear()
|
|
67
|
+
logger.info("SocketInitiator starting %d session(s)", len(self._sessions))
|
|
64
68
|
for sid, session in self._sessions.items():
|
|
65
69
|
task = asyncio.create_task(
|
|
66
70
|
self._connect_loop(sid, session),
|
|
67
71
|
name=f"initiator-{sid}",
|
|
68
72
|
)
|
|
69
73
|
self._tasks.append(task)
|
|
74
|
+
logger.debug("Connect-loop task created for %s", sid)
|
|
70
75
|
|
|
71
76
|
async def stop(self) -> None:
|
|
72
77
|
"""Signal all connect loops to exit and wait for them to finish."""
|
|
@@ -108,14 +113,17 @@ class SocketInitiator:
|
|
|
108
113
|
port = int(self._settings.get(sid, "SocketConnectPort"))
|
|
109
114
|
reconnect = self._settings.get_int(sid, "ReconnectInterval", 10)
|
|
110
115
|
|
|
116
|
+
logger.info("[%s] Connect loop started — target %s:%s", sid, host, port)
|
|
111
117
|
while not self._stop_event.is_set():
|
|
118
|
+
logger.debug("[%s] Attempting connection to %s:%s", sid, host, port)
|
|
112
119
|
try:
|
|
113
120
|
reader, writer = await asyncio.open_connection(host, port)
|
|
114
|
-
except OSError:
|
|
115
|
-
|
|
121
|
+
except OSError as exc:
|
|
122
|
+
logger.warning("[%s] Connection failed: %s — retrying in %ss", sid, exc, reconnect)
|
|
116
123
|
await self._interruptible_sleep(reconnect)
|
|
117
124
|
continue
|
|
118
125
|
|
|
126
|
+
logger.info("[%s] TCP connected to %s:%s", sid, host, port)
|
|
119
127
|
framer = MessageFramer()
|
|
120
128
|
|
|
121
129
|
async def send_fn(data: bytes, _w: asyncio.StreamWriter = writer) -> None:
|
|
@@ -123,21 +131,26 @@ class SocketInitiator:
|
|
|
123
131
|
await _w.drain()
|
|
124
132
|
|
|
125
133
|
await session.on_connect(send_fn)
|
|
134
|
+
logger.debug("[%s] on_connect complete — Logon sent", sid)
|
|
126
135
|
|
|
127
136
|
try:
|
|
128
137
|
while not self._stop_event.is_set():
|
|
129
138
|
try:
|
|
130
139
|
data = await reader.read(4096)
|
|
131
140
|
except (ConnectionResetError, asyncio.IncompleteReadError,
|
|
132
|
-
asyncio.CancelledError):
|
|
141
|
+
asyncio.CancelledError) as exc:
|
|
142
|
+
logger.info("[%s] Read interrupted: %s", sid, type(exc).__name__)
|
|
133
143
|
break
|
|
134
144
|
if not data:
|
|
145
|
+
logger.info("[%s] Connection closed by peer", sid)
|
|
135
146
|
break
|
|
136
147
|
|
|
148
|
+
logger.debug("[%s] Received %d bytes", sid, len(data))
|
|
137
149
|
for raw_msg in framer.feed(data):
|
|
138
150
|
await session.on_data(raw_msg)
|
|
139
151
|
|
|
140
152
|
finally:
|
|
153
|
+
logger.info("[%s] Disconnecting", sid)
|
|
141
154
|
await session.on_disconnect()
|
|
142
155
|
try:
|
|
143
156
|
writer.close()
|
|
@@ -147,6 +160,7 @@ class SocketInitiator:
|
|
|
147
160
|
framer.reset()
|
|
148
161
|
|
|
149
162
|
if not self._stop_event.is_set() and not self._no_reconnect.is_set():
|
|
163
|
+
logger.info("[%s] Waiting %ss before reconnect", sid, reconnect)
|
|
150
164
|
await self._interruptible_sleep(reconnect)
|
|
151
165
|
|
|
152
166
|
async def _interruptible_sleep(self, seconds: float) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|