diff --git a/src/i_comm_manager.c b/src/i_comm_manager.c index d6f5344..5f295f3 100644 --- a/src/i_comm_manager.c +++ b/src/i_comm_manager.c @@ -90,10 +90,13 @@ TR_commManagerSelect(void * _this, TR_Event event) TR_Timer timer = (TR_Timer)event->data; TR_EventDispatcher dispatcher = (TR_EventDispatcher)event->subject; unsigned long timeout; // milliseconds + unsigned long io_triggerd; - if (! (TR_hashEmpty(this->read) - && TR_hashEmpty(this->write) - && TR_hashEmpty(this->accept))) { + io_triggerd = TR_hashEach(this->write, this, commManagerIssueWriteEvents); + io_triggerd += TR_hashEach(this->accept, this, commManagerIssueAcceptEvents); + io_triggerd += TR_hashEach(this->read, this, commManagerIssueReadEvents); + + if (io_triggerd) { timeout = 0; } else if (NULL == timer) { timeout = TR_eventDispatcherGetDataWaitTime(dispatcher); @@ -103,10 +106,6 @@ TR_commManagerSelect(void * _this, TR_Event event) TR_CALL(_this, TR_CommManager, select, event, timeout); - TR_hashEach(this->write, this, commManagerIssueWriteEvents); - TR_hashEach(this->accept, this, commManagerIssueAcceptEvents); - TR_hashEach(this->read, this, commManagerIssueReadEvents); - return TR_EVENT_DONE; } diff --git a/testers/build.sh b/testers/build.sh index 829a188..ce1b16a 100755 --- a/testers/build.sh +++ b/testers/build.sh @@ -2,8 +2,8 @@ #TRLIBS="-ltrbase -ltrhashing -ltrio -ltrdata -ltrevent -ltrcomm" TRLIBS="/usr/local/lib/libtrcomm.a /usr/local/lib/libtrevent.a /usr/local/lib/libtrdata.a /usr/local/lib/libtrio.a /usr/local/lib/libtrhashing.a /usr/local/lib/libtrbase.a" LIBS="-lcrypto -lssl -lrt -luuid" -gcc ${CFLAGS} -c -o test_handler.o test_handler.c -gcc ${CFLAGS} -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver testserver.c test_handler.o ${TRLIBS} -gcc ${CFLAGS} -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver2 testserver2.c test_handler.o ${TRLIBS} -gcc ${CFLAGS} -I/usr/local/include -L/usr/local/lib ${LIBS} -o testtcp testclient.c ${TRLIBS} -gcc ${CFLAGS} -I/usr/local/include -L/usr/local/lib ${LIBS} -DUDP=1 -o testudp testclient.c ${TRLIBS} +gcc ${CFLAGS} -std=c99 -c -o test_handler.o test_handler.c +gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver testserver.c test_handler.o ${TRLIBS} +gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testserver2 testserver2.c test_handler.o ${TRLIBS} +gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -o testtcp testclient.c ${TRLIBS} +gcc ${CFLAGS} -std=c99 -I/usr/local/include -L/usr/local/lib ${LIBS} -DUDP=1 -o testudp testclient.c ${TRLIBS}