Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 7b623317 authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Revise network communication backend and message-parsing logic.

- Introduce a new 'declearn.communication.api.backend' submodule:
  - Introduce a new 'ActionMessage' minimal backend API, that defines
    hard-coded, lightweight and easily-parsed data structures designed
    to convey information and content across network communications
    agnostic to the content's nature.
  - Move 'declearn.communication.messaging.flags' submodule to
    'declearn.communication.api.backend.flags'.
  - Move 'MessagesHandler' semi-private class to the 'backend'
    submodule, where it is now properly exposed.

- Revise 'MessagesHandler':
  - Have it use the new 'ActionMessage's to wrap up messages, and
    delay their content's parsing to other times and parts of the
    code.
  - Quit sending information together with registration requests.
    In the future, we may want to introduce some callback system to
    validate or complete a registration request's processing.
  - Turn 'heartbeat' into an instantiation parameter.

- Revise 'NetworkClient' and 'NetworkServer':
  - Quit passing of 'data_info' with registration requests.
  - Have message-sending and message-receiving methods expect str
    inputs and return str outputs: the actual parsing into objects
    is therefore delayed and left to be defined elsewhere.
  - Rename 'NetworkClient.check_message' into 'recv_message' (keep
    the former as an alias, with a DeprecationWarning).
  - Improve the use of (optional) timeouts when sending or expecting
    messages and overall exceptions handling:
    - 'NetworkClient.recv_message' may either raise a TimeoutError
      (in case of timeout) or RuntimeError (in case of rejection).
    - 'NeworkServer.send_messages' and 'broadcast_message' quietly
      stops waiting for clients to collect messages after the (opt.)
      timeout delay has passed. Messages may still be collected.
    - 'NetworkServer.wait_for_messages' no longer accepts a timeout.
    - 'NetworkServer.wait_for_messages_with_timeout' implements the
      possibility to setup a timeout. It returns both received client
      replies and a list of clients that failed to answer.
parent 7c65a283
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment