Skip to content

PollManager part#25

Merged
byronlove111 merged 9 commits into
mainfrom
core-server
Jun 18, 2026
Merged

PollManager part#25
byronlove111 merged 9 commits into
mainfrom
core-server

Conversation

@Jyzdcs

@Jyzdcs Jyzdcs commented Jun 18, 2026

Copy link
Copy Markdown
Owner

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 PollManager
tests/server/test_poll_manager.cpp -> 1 gros test generer a l'ia et 1 deuxieme fais par moi
include/server/README.md -> readme servant a donner une explication ultra concise chaque partie et de leur liens
include/server/server-checklist.md -> checklist personnelle pour la partie server-core
include/server/Client.hpp -> Prototype et declaration de la class Client
include/server/Socket.hpp -> Prototype et declaration de la class Socket

Class 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 stocker
void addFd(int fd, short events) = ajouter un fd à surveiller
void removeFd(int fd) = retirer un fd de la liste
void updateEvents(int fd, short events) = changer les events à surveillés
int pollEngine(int timeout_ms) = appeler poll() sur la liste
bool isReadable(int fd) const = savoir si un fd est pret en lecture
bool isWritable(int fd) const = savoir si un fd est pret pour l'ecriture
bool hasError(int fd) const = detecter une erreur sur un fd
const std::vector<struct pollfd>& getFds() const = exposer la liste complete des fds actuellement surveillés

Little Changes

  • ajout de a.out dans le .gitignore

Jyzdcs added 9 commits June 15, 2026 15:43
… 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.
@byronlove111 byronlove111 merged commit 90040f9 into main Jun 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants