|
|
@ -14,7 +14,7 @@ |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
server_select(SERVER this) { |
|
|
|
|
|
|
|
|
server_poll(SERVER this) { |
|
|
int events; |
|
|
int events; |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
@ -73,8 +73,7 @@ server_read(SERVER this) |
|
|
|
|
|
|
|
|
for (i=1; i<this->nfds; i++) { |
|
|
for (i=1; i<this->nfds; i++) { |
|
|
if (0 != ((this->fds)[i].revents & POLLIN)) { |
|
|
if (0 != ((this->fds)[i].revents & POLLIN)) { |
|
|
memset(buffer, 0, 1024); |
|
|
|
|
|
switch (_read = read((this->fds)[i].fd, buffer, 1023)) { |
|
|
|
|
|
|
|
|
switch (_read = read((this->fds)[i].fd, buffer, 1024)) { |
|
|
case 0: |
|
|
case 0: |
|
|
/* |
|
|
/* |
|
|
* normal close: write remaining data |
|
|
* normal close: write remaining data |
|
|
@ -92,7 +91,7 @@ server_read(SERVER this) |
|
|
default: |
|
|
default: |
|
|
(this->fds)[i].revents |= POLLIN; |
|
|
(this->fds)[i].revents |= POLLIN; |
|
|
if (NULL != this->read_hook) { |
|
|
if (NULL != this->read_hook) { |
|
|
this->read_hook(buffer); |
|
|
|
|
|
|
|
|
this->read_hook(buffer, _read); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
@ -117,7 +116,7 @@ server_run(SERVER this) |
|
|
* @TODO take return value of poll into account with |
|
|
* @TODO take return value of poll into account with |
|
|
* further handling! |
|
|
* further handling! |
|
|
*/ |
|
|
*/ |
|
|
events = server_select(this); |
|
|
|
|
|
|
|
|
events = server_poll(this); |
|
|
if (doShutdown) break; |
|
|
if (doShutdown) break; |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
|