Browse Source

accept as much as possible and stop processing as soon as possible

release0.1.6
Georg Hopp 12 years ago
parent
commit
d1ebca057b
  1. 17
      src/server/run.c

17
src/server/run.c

@ -55,18 +55,24 @@ serverRun(Server this)
* handle accept * handle accept
*/ */
if (0 != ((this->fds)[0].revents & POLLIN)) { if (0 != ((this->fds)[0].revents & POLLIN)) {
if (0 > serverHandleAccept(this, 0)) {
while (0 < serverHandleAccept(this, 0)) {}
events--; events--;
} }
if (events == 0) {
continue;
} }
/** /**
* handle accept SSL * handle accept SSL
*/ */
if (0 != ((this->fds)[1].revents & POLLIN)) { if (0 != ((this->fds)[1].revents & POLLIN)) {
if (0 > serverHandleAccept(this, 1)) {
while (0 < serverHandleAccept(this, 1)) {}
events--; events--;
} }
if (events == 0) {
continue;
} }
for (i=2; i < this->nfds; i++) { for (i=2; i < this->nfds; i++) {
@ -93,6 +99,10 @@ serverRun(Server this)
} }
} }
if (events == 0) {
break;
}
/** /**
* handle writes * handle writes
*/ */
@ -122,10 +132,11 @@ serverRun(Server this)
} }
} }
if (0 >= events)
if (events == 0) {
break; // no more events to handle break; // no more events to handle
} }
} }
}
} }
// vim: set ts=4 sw=4: // vim: set ts=4 sw=4:
Loading…
Cancel
Save