#include <FountainSocketHandlers.h>
Inheritance diagram for FountainSocketHandlers:

Public Member Functions | |
| FountainWireProtPtr | CheckConnections () |
| Checks existing connections for data to be read and listening sockets for incoming connections. | |
Static Private Member Functions | |
| static void | addSocket (int socket) |
| Add an open file descriptor to the open sockets vector. | |
| static void | removeSocket (int socket) |
| Remove an open file descriptor from the open sockets vector. | |
Friends | |
| class | FountainWireProt |
This class inherits publicly from the BambooLib::ServerSocketHandlers class and overloads the CheckConnections method. It has to do this since the BambooLib::ServerSocketHandlers class does not maintain a list of previously opened sockets. This is fine for transient connections which are closed immediately after servicing the request message for that connection. However, each Fountain daemon maintains persistent connections to other Fountain node daemons. To respond to requests from each node's parent connection in a timely fashion, this class needs to break out of the select system call when one of the following conditions is true:
It accomplishes the first requirement by using the BambooLib::ServerSocketHandlers::CheckConnections method since it was designed to listen for incoming connections. The second requirement is accomplished by maintaining a std::vector<int> object containing the file descriptors of all previously opened sockets. These sockets are created in two places:
This client and server socket distinction is only in place to show where and how they are created. In the context of this class and Fountain components, no distinction is made between client or server sockets. The open socket vector is maintained in three places:
The open socket vector itself is defined in an anonymous namespace in the FountainSocketHandlers.cpp file. The methods to add and remove a file descriptor to the vector are private. The FountainWireProt class is a friend class of this class so it can access these methods.
|
|
Checks existing connections for data to be read and listening sockets for incoming connections.
Reimplemented from BambooLib::ServerSocketHandlers. |
1.4.6