Nog een poging...
This commit is contained in:
parent
4ad85c9aac
commit
4776cd08d7
1 changed files with 55 additions and 59 deletions
|
@ -71,7 +71,7 @@ int main(){
|
|||
int retval;
|
||||
int poller = epoll_create(1);
|
||||
struct epoll_event ev;
|
||||
ev.events = EPOLLIN | EPOLLOUT;
|
||||
ev.events = EPOLLIN;
|
||||
ev.data.fd = fileno(CONN);
|
||||
epoll_ctl(poller, EPOLL_CTL_ADD, fileno(CONN), &ev);
|
||||
struct epoll_event events[1];
|
||||
|
@ -82,13 +82,11 @@ int main(){
|
|||
while (!ferror(CONN) && !feof(CONN)){
|
||||
//only parse input if available or not yet init'ed
|
||||
//rightnow = getNowMS();
|
||||
retval = epoll_wait(poller, events, 1, 1000);
|
||||
if (retval){
|
||||
if (events[0].events & EPOLLIN){
|
||||
retval = epoll_wait(poller, events, 1, 100);
|
||||
if (retval > 0){
|
||||
parseChunk();
|
||||
fflush(CONN);
|
||||
}
|
||||
if (events[0].events & EPOLLOUT){
|
||||
if (ready4data){
|
||||
if (!inited){
|
||||
//we are ready, connect the socket!
|
||||
|
@ -143,8 +141,6 @@ int main(){
|
|||
SendCTL(3, rec_cnt);//send ack (msg 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "User disconnected.\n");
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue