Implemented handshake in json server and handoff to endpoint Endpoint handles connector handshake accept/decline then launches both its IO threads alongside its heartbeat thread which contains simple timeout logic, timeout calls connection handles to close, subsequently killing the endpoint
29 lines
620 B
Python
29 lines
620 B
Python
import logging
|
|
|
|
from rich.logging import RichHandler
|
|
|
|
from dynalab_core import Core
|
|
from dynalab_core.config import CoreConfig
|
|
|
|
logging.basicConfig(
|
|
level=logging.DEBUG,
|
|
format="%(name)s %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
handlers=[RichHandler(rich_tracebacks=True, show_path=False)],
|
|
force=True,
|
|
)
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
config = CoreConfig(port=8765)
|
|
log.info("Configured manual core on %s", config.bind_str())
|
|
dl_core = Core(config)
|
|
dl_core.start()
|
|
|
|
try:
|
|
while True:
|
|
dl_core.wait(1)
|
|
except KeyboardInterrupt:
|
|
log.info("Received keyboard interrupt")
|
|
dl_core.stop()
|