/* int TcpServer::_c2s_client_mio_callback(mio_t m, mio_action_t a, int fd, void *data, void *arg) */ int TcpServer::_c2s_client_mio2_callback(mio2_t m, mio2_action_t a, int fd, void *data, void *arg) { TcpServer* pthis = NULL; c2s_t c2s = NULL; if (arg) { c2s = (c2s_t)arg; pthis = (TcpServer*)(((c2s_t)arg)->pvoid); } switch(a) { /* case action_READ: */ case mio2_action_READ: //do NOT accept new connect while restart if (pthis->IsRestarting()) { return 0; } return pthis->RevData(fd, m); /* case action_WRITE: */ case mio2_action_WRITE: /* return 0; */ return 1; /* case action_CLOSE: */ case mio2_action_CLOSE: return 0; /* case action_ACCEPT: */ case mio2_action_ACCEPT: //c2s->highfd = GetHighfd(m); gvLog(LOG_MSG, "(TcpServer::_c2s_client_mio_callback) Accept connect IP=%s(%d)...", data, fd); //add by using epoll return 1; } return 0; }