diff --git a/Server/Server.cpp b/Server/Server.cpp index 0de9cb7..febd771 100644 --- a/Server/Server.cpp +++ b/Server/Server.cpp @@ -60,7 +60,9 @@ int Server::run() { while (true) { - poll(this->fds.data(), this->fds.size(), -1); + int ret = poll(this->fds.data(), this->fds.size(), -1); + if (ret < 0) + break ; for(unsigned int i = 0; i < this->fds.size(); i++) { @@ -114,7 +116,7 @@ void Server::readClient(int fd) while ((pos = clientBuf.find('\n')) != std::string::npos) { std::string line = clientBuf.substr(0, pos); - clients[fd].clearBuffer(); + clientBuf = clientBuf.substr(pos + 1); if (!line.empty() && line[line.size() - 1] == '\r') line.erase(line.size() - 1); diff --git a/commands/nick.cpp b/commands/nick.cpp index 4a129b6..bec31bc 100644 --- a/commands/nick.cpp +++ b/commands/nick.cpp @@ -6,7 +6,7 @@ /* By: aortigos