This repository contains a base implementation for the Spring 2023 Concurrent Programming project.
-
Base implementation means it is not feature complete and may have errors.
-
It uses a threads per connection, requiring two platform threads per connected client. The main goal of the project is to change this design to mainly use coroutines instead of threads to handle each client connection.
For any question regarding this base implementation, please open an issue at https://github.com/isel-leic-pc/s2223v-se3/issues.
Be aware of any commits with corrections or improvements to this base implementation by looking at the project's commit history.
This base implementation uses the following design:
-
Each server instance has one thread to listen for new connections and creates a client instance for each. Most of the time, this thread will be blocked waiting for a new connection.
-
Each client instance uses two threads:
- a main thread that reads and processes control messages from a control queue. These control messages can be:
- A text message posted to a room where the client is present.
- A text line sent by the remote connected client.
- An indication that the read stream from the remote connected client ended.
- An indication that the handling of the client should end (e.g. because the server is ending).
- a read thread that reads lines from the remote client connection and transform these into control messages sent to the main thread.
- a main thread that reads and processes control messages from a control queue. These control messages can be:
-
Most interactions with the client are done by sending messages to the client control queue.