Nick fixed
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user