Commit Diff


commit - 5f7c62fa4d1a3b756119f7e279c5753036c3e9d1
commit + 681d8d4923321c8caf195fd32a7682c98b61ec07
blob - 751296772ad0026f559d1f5fa2f455510a2bee1b
blob + c573677a17c5c861eb6275a1d6f5768cdb8f8fec
--- ioev.c
+++ ioev.c
@@ -102,8 +102,9 @@ static struct io	*current = NULL;
 static uint64_t		 frame = 0;
 static int		_io_debug = 0;
 
-#define io_debug(args...) do { if (_io_debug) printf(args); } while(0)
+//#define io_debug(args...) do { if (_io_debug) printf(args); } while(0)
 
+#define io_debug(args...) do { fprintf(stderr, args); } while(0)
 
 const char*
 io_strio(struct io *io)
@@ -567,7 +568,8 @@ io_reset(struct io *io, short events, void (*dispatch)
 	 */
 	io->flags |= IO_RESET;
 
-	if (event_initialized(&io->ev))
+	if (event_initialized(&io->ev) &&
+	    event_pending(&io->ev, EV_READ|EV_WRITE, NULL))
 		event_del(&io->ev);
 
 	/*