Implemented handshake and heartbeat
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
This commit is contained in:
+15
-4
@@ -1,17 +1,28 @@
|
||||
from time import sleep
|
||||
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)
|
||||
print(config)
|
||||
log.info("Configured manual core on %s", config.bind_str())
|
||||
dl_core = Core(config)
|
||||
dl_core.start()
|
||||
print("started")
|
||||
|
||||
try:
|
||||
while True:
|
||||
dl_core.wait(1)
|
||||
print("waiting")
|
||||
except KeyboardInterrupt:
|
||||
log.info("Received keyboard interrupt")
|
||||
dl_core.stop()
|
||||
|
||||
Reference in New Issue
Block a user