New version, state2string updated
This commit is contained in:
parent
2cf646d948
commit
82b70e3877
@ -168,6 +168,8 @@ gw_dcb_state2string (int state) {
|
||||
return "DCB for listening socket";
|
||||
case DCB_STATE_DISCONNECTED:
|
||||
return "DCB socket closed";
|
||||
case DCB_STATE_FREED:
|
||||
return "DCB memory could be freed";
|
||||
default:
|
||||
return "DCB (unknown)";
|
||||
}
|
||||
|
@ -218,21 +218,22 @@ int main(int argc, char **argv) {
|
||||
// event loop for all the descriptors added via epoll_ctl
|
||||
while (1) {
|
||||
nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
|
||||
// example with timeout
|
||||
//nfds = epoll_wait(epollfd, events, MAX_EVENTS, 1000);
|
||||
if (nfds == -1 && (errno != EINTR)) {
|
||||
perror("GW: epoll_pwait ERROR");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//#ifdef GW_EVENT_DEBUG
|
||||
#ifdef GW_EVENT_DEBUG
|
||||
fprintf(stderr, "wake from epoll_wait, n. %i events\n", nfds);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
for (n = 0; n < nfds; ++n) {
|
||||
DCB *dcb = (DCB *) (events[n].data.ptr);
|
||||
|
||||
|
||||
//#ifdef GW_EVENT_DEBUG
|
||||
#ifdef GW_EVENT_DEBUG
|
||||
fprintf(stderr, "New event %i for socket %i is %i\n", n, dcb->fd, events[n].events);
|
||||
if (events[n].events & EPOLLIN)
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLIN\n", n, dcb->fd);
|
||||
@ -240,8 +241,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLOUT\n", n, dcb->fd);
|
||||
if (events[n].events & EPOLLPRI)
|
||||
fprintf(stderr, "New event %i for socket %i is EPOLLPRI\n", n, dcb->fd);
|
||||
|
||||
//#endif
|
||||
#endif
|
||||
if (events[n].events & (EPOLLERR | EPOLLHUP)) {
|
||||
fprintf(stderr, "CALL the ERROR pointer\n");
|
||||
(dcb->func).error(dcb, events[n].events);
|
||||
|
@ -205,9 +205,9 @@ int gw_route_read_event(DCB* dcb, int epfd) {
|
||||
fprintf(stderr, "Client IOCTL FIONREAD bytes to read = %i\n", b);
|
||||
}
|
||||
|
||||
//#ifdef GW_DEBUG_READ_EVENT
|
||||
#ifdef GW_DEBUG_READ_EVENT
|
||||
fprintf(stderr, "Client DCB [%s], EPOLLIN Protocol state [%i] for socket %i, scramble [%s]\n", gw_dcb_state2string(dcb->state), protocol->state, dcb->fd, protocol->scramble);
|
||||
//#endif
|
||||
#endif
|
||||
switch (protocol->state) {
|
||||
case MYSQL_AUTH_SENT:
|
||||
// read client auth
|
||||
|
Loading…
x
Reference in New Issue
Block a user