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 retval; | ||||||
|   int poller = epoll_create(1); |   int poller = epoll_create(1); | ||||||
|   struct epoll_event ev; |   struct epoll_event ev; | ||||||
|   ev.events = EPOLLIN | EPOLLOUT; |   ev.events = EPOLLIN; | ||||||
|   ev.data.fd = fileno(CONN); |   ev.data.fd = fileno(CONN); | ||||||
|   epoll_ctl(poller, EPOLL_CTL_ADD, fileno(CONN), &ev); |   epoll_ctl(poller, EPOLL_CTL_ADD, fileno(CONN), &ev); | ||||||
|   struct epoll_event events[1]; |   struct epoll_event events[1]; | ||||||
|  | @ -82,13 +82,11 @@ int main(){ | ||||||
|   while (!ferror(CONN) && !feof(CONN)){ |   while (!ferror(CONN) && !feof(CONN)){ | ||||||
|     //only parse input if available or not yet init'ed
 |     //only parse input if available or not yet init'ed
 | ||||||
|     //rightnow = getNowMS();
 |     //rightnow = getNowMS();
 | ||||||
|     retval = epoll_wait(poller, events, 1, 1000); |     retval = epoll_wait(poller, events, 1, 100); | ||||||
|     if (retval){ |     if (retval > 0){ | ||||||
|       if (events[0].events & EPOLLIN){ |  | ||||||
|       parseChunk(); |       parseChunk(); | ||||||
|       fflush(CONN); |       fflush(CONN); | ||||||
|     } |     } | ||||||
|       if (events[0].events & EPOLLOUT){ |  | ||||||
|     if (ready4data){ |     if (ready4data){ | ||||||
|       if (!inited){ |       if (!inited){ | ||||||
|         //we are ready, connect the socket!
 |         //we are ready, connect the socket!
 | ||||||
|  | @ -143,8 +141,6 @@ int main(){ | ||||||
|       SendCTL(3, rec_cnt);//send ack (msg 3)
 |       SendCTL(3, rec_cnt);//send ack (msg 3)
 | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|     } |  | ||||||
|   } |  | ||||||
|   #ifdef DEBUG |   #ifdef DEBUG | ||||||
|   fprintf(stderr, "User disconnected.\n"); |   fprintf(stderr, "User disconnected.\n"); | ||||||
|   #endif |   #endif | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma