PollManager part#25
Merged
Merged
Conversation
… Socket, and Server classes - Added Client class to manage TCP connection state and data handling. - Introduced PollManager for managing file descriptors and polling events. - Created Socket class for encapsulating server socket operations. - Developed Server class to orchestrate connections and handle client interactions. - Updated README with usage instructions and project structure. - Removed unnecessary .gitignore entries in the server directory.
- Added PollManager class to centralize the management of file descriptors monitored by poll(). - Implemented methods for adding, removing, and querying file descriptors. - Created main.cpp to demonstrate PollManager functionality with basic operations. - Included necessary headers and defined class methods in PollManager.cpp.
…nment operator - Removed the non-copyable constructor and assignment operator from PollManager as they were not implemented. - Renamed the poll() method to pollEngine() for clarity. - Added a new test file for PollManager to validate its methods using stdin as a mock event source. - Updated .gitignore to include a.out and .vscode directories.
…e tests - Updated main.cpp to test the isReadable and isWritable methods of PollManager. - Added functionality to switch between listening for readable and writable events. - Cleaned up commented-out code for better readability.
- Deleted main.cpp which contained test code for PollManager's isReadable and isWritable methods. - Cleaned up the repository by removing unused test code.
…thod - Updated the removeFd method to use size_t for the index variable, improving type safety and consistency with the vector size type.
…sed code - Commented out the PollManager includes and the printStep function to improve readability. - Maintained the structure of the main function while ensuring that the test logic remains intact for future use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
La partie core server est composé de 4 parties : PollManager, Client, Server et Socket. Cette PR represente l'implementation complete du PollManager representé par 1 class comportant 9 methodes public.
Changes Made
/src/sever/PollManager.cpp-> Implementation des declarations presente dans le fichier .hpp/include/sever/PollManager.hpp-> Prototype et declaration de la class PollManagertests/server/test_poll_manager.cpp-> 1 gros test generer a l'ia et 1 deuxieme fais par moiinclude/server/README.md-> readme servant a donner une explication ultra concise chaque partie et de leur liensinclude/server/server-checklist.md-> checklist personnelle pour la partie server-coreinclude/server/Client.hpp-> Prototype et declaration de la class Clientinclude/server/Socket.hpp-> Prototype et declaration de la class SocketClass Explanations
La class PollManager a pour but de CENTRALISER la liste des files decriptors surveillés par poll() et exposer une interface simple pour les ajouter/retirer/interoger. Elle NE SAIT PAS ce qu'est un client HTTP, un CGI ou un socket d'ecoute. Elle manipule uniquement des entiers (fd) et des flags (POLLIN, POLLOUT). C'estl a frontiere la plus basse du server.
int getSize() const= obtenir le nombre de fds actuellement stockervoid addFd(int fd, short events)= ajouter un fd à surveillervoid removeFd(int fd)= retirer un fd de la listevoid updateEvents(int fd, short events)= changer les events à surveillésint pollEngine(int timeout_ms)= appeler poll() sur la listebool isReadable(int fd) const= savoir si un fd est pret en lecturebool isWritable(int fd) const= savoir si un fd est pret pour l'ecriturebool hasError(int fd) const= detecter une erreur sur un fdconst std::vector<struct pollfd>& getFds() const= exposer la liste complete des fds actuellement surveillésLittle Changes