|
|
|
@ -129,12 +129,28 @@ serverRun(Server this) |
|
|
|
* handle writes |
|
|
|
*/ |
|
|
|
if (0 != ((this->fds)[i].revents & POLLOUT)) { |
|
|
|
write( |
|
|
|
int size; |
|
|
|
|
|
|
|
size = write( |
|
|
|
(this->fds)[i].fd, |
|
|
|
(this->conns)[fd].wbuf, |
|
|
|
strlen((this->conns)[fd].wbuf)); |
|
|
|
(this->fds)[i].events = (this->fds)[i].events & ~POLLOUT; |
|
|
|
serverCloseConn(this, i); |
|
|
|
|
|
|
|
if (size == strlen((this->conns)[fd].wbuf) || |
|
|
|
-1 == size) { |
|
|
|
if (-1 == size) { |
|
|
|
loggerLog(this->logger, LOGGER_ERR, |
|
|
|
"write error, closing connection"); |
|
|
|
} |
|
|
|
|
|
|
|
(this->fds)[i].events = (this->fds)[i].events & ~POLLOUT; |
|
|
|
serverCloseConn(this, i); |
|
|
|
} |
|
|
|
else { |
|
|
|
memmove((this->conns)[fd].wbuf, |
|
|
|
(this->conns)[fd].wbuf + size, |
|
|
|
strlen((this->conns)[fd].wbuf) - size + 1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|