Skip to content

Commit

Permalink
small changes for more readability
Browse files Browse the repository at this point in the history
  • Loading branch information
redone committed Jan 19, 2024
1 parent 9641d0a commit 63f8cd5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/IRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ extern volatile sig_atomic_t serverIsRunning;
#include <poll.h>
#include <string>
#include <sys/socket.h>
#include <algorithm>
#include <unistd.h>
#include <vector>

Expand Down
9 changes: 6 additions & 3 deletions srcs/Utils/Utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Utils.hpp"
#include <cstdlib>
#include <sstream>

std::string Utils::join(const std::vector<std::string>& arr) {
Expand All @@ -19,9 +20,11 @@ std::string Utils::join(const std::vector<std::string>& arr) {
}

std::string Utils::toStr(int nbr) {
std::stringstream ss(nbr);

return ss.str();
std::string ret;
std::ostringstream convert;
convert << nbr;
ret = convert.str();
return ret;
}

bool Utils::isAllDigits(const char* str) {
Expand Down
4 changes: 0 additions & 4 deletions srcs/server/Reactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ Reactor::~Reactor() {
it != _clients.end(); ++it) {
delete *it;
}
for (std::vector<pollfd>::iterator it = _pollfds.begin();
it != _pollfds.end(); ++it) {
close(it->fd);
}
_clients.clear();
_pollfds.clear();
}
Expand Down
4 changes: 4 additions & 0 deletions srcs/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ void Server::run() {
const char* Server::getPasswd() const {
return _passwd;
}
Server::~Server() {
std::cout << "Closing server\n";
close(_sock.getSocketFd());
}
1 change: 1 addition & 0 deletions srcs/server/Server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class Server {
public:
explicit Server(const char* port, const char* passwd);
~Server();
void run();
const char* getPasswd() const;

Expand Down

0 comments on commit 63f8cd5

Please sign in to comment.