#include <node_manager.hpp>
Public Types | |
| enum | { data, command } |
| enum | { quit, start, result, reset_client, reset_subclient } |
Public Methods | |
| int | test_and_get () |
| This function is the atomic test_and_get function. It atomically checks for a free socket in the list of free sockets. | |
| void | recycle_socket (int sock_id) |
| Atomically adds the file descriptor of the socket given by sock_id to the list of free sockets. | |
| void | send_vector (eqn_cruncher::matrix_t const &dv, eqn_cruncher::socket s) |
| This function sends a square matrix to the remote client for solving the determinant. | |
| void | server (server_data *psd) |
| This is the main listening server thread. | |
| double | get_vector (eqn_cruncher::socket s, unsigned int mat_size, double(*det_proc)(matrix_t const &)) |
| This function gets the square matrix from the server and then processes it to compute its determinant. It is called from the client context. | |
| void | close_sockets () |
| Closes all the sockets of the clients cached in the list of free clients. | |
| void | send_message (eqn_cruncher::pkt_header ph) |
| Sends a message having the packet header ph to all the clients connected to the current object. | |
| void | send_reset_client_msg () |
| Sends a 'reset_client' message to all the clients connected to the current object. | |
| void | send_reset_subclient_msg () |
| Sends a 'reset_subclient' message to all the clients connected to the current object. | |
| void | send_quit_msg () |
| Sends a 'quit' message to all the clients connected to the current object. | |
|
|
|
|
|
|
Closes all the sockets of the clients cached in the list of free clients. Hence, it disconnects itself from all the clients currently connected to the server which owns the current object. |
|
||||||||||||||||
|
This function gets the square matrix from the server and then processes it to compute its determinant. It is called from the client context. This procedure is called by the remote client when it catches the start command. It basically parses the input data stream, and stores the data in a local matrix. Then, the procedure specified by the parameter det_proc is called on the matrix of type matrix_t.
|
|
|
Atomically adds the file descriptor of the socket given by sock_id to the list of free sockets.
|
|
|
Sends a message having the packet header ph to all the clients connected to the current object.
|
|
|
Sends a 'quit' message to all the clients connected to the current object.
|
|
|
Sends a 'reset_client' message to all the clients connected to the current object.
|
|
|
Sends a 'reset_subclient' message to all the clients connected to the current object.
|
|
||||||||||||
|
This function sends a square matrix to the remote client for solving the determinant. First send a header containing only a command. This command header shold contain only the start command, and the size of the square matrix in the form of row size ONLY in the reserved field. The client can then calculate the total size of the matrix from the row size, knowing that the matrix is a square matrix, and each field is a double data type. The command header contains the size member as 0, because there is no data to be transmitted. The client always verifies the packet size by adding the size field to the sizeof(pkt_header), and checking if it is equal to the value returned by the receive function.
|
|
|
This is the main listening server thread. This is the main server thread, which continuously listens for at most max_queue connections. As and when they come along, the sockets are connected, and they socket IDs are added to the list of socket IDs. This lets us reuse and recycle the socket IDs at will.
|
|
|
This function is the atomic test_and_get function. It atomically checks for a free socket in the list of free sockets.
|
1.2.18