IP task on controller side
On the controller, the IP task opens a main socket where it receives the connection requests from the trackers. The IP task is always waiting for an event; iteration is done if the task receives an event.
The main events that the IP task can receive are:
- There is work on the TIPQ.
- There is a connection request from a tracker (connect() from tracker).
- There are bytes to be read on a socket (write() from tracker).
- Bytes are to be written on a socket (write() to tracker).
- A started task stop request must be processed.
- The loop timeout has expired.
- Task abnormal end.
When the IP task receives an event, it starts iterating and checks:
- Whether the loop timeout has expired or an abnormal end occurred.
- The reading sockets to verify if:
- There is a connection request from a tracker on the task main
socket.
The task checks that the IP address or host name and the port number match with the IP addresses, host names, and port numbers specified in the initialization parameters. If any value is not valid or already in use, the connection requested is not established.
- There are bytes to be received from trackers
If there are, they are received by the controller.
- There is a connection request from a tracker on the task main
socket.
- The task queue. If there is work on the TIPQ, the IP task stores the entries in another internal queue of the task for later processing.
- The write sockets to verify if there is a connection() or write() request pending for the remote tracker that must be processed. The request result is checked.
- Whether there are entries in the internal queue. If there are, the IP task processes the DQE and sends the data to the remote trackers.