diff --git a/include/tr/interface/comm_manager.h b/include/tr/interface/comm_manager.h index 50cc755..c557278 100644 --- a/include/tr/interface/comm_manager.h +++ b/include/tr/interface/comm_manager.h @@ -30,13 +30,13 @@ #include "tr/comm_end_point.h" -typedef void (* fptr_TR_commManagerAddEndpoint)(void *, TR_CommEndPoint); -typedef void (* fptr_TR_commManagerSelect)(void *, TR_Event, int); -typedef void (* fptr_TR_commManagerEnableWrite)(void *, TR_Event); -typedef void (* fptr_TR_commManagerDisableWrite)(void *, TR_Event); -typedef void (* fptr_TR_commManagerClose)(void *, TR_Event); -typedef void (* fptr_TR_commManagerShutdownRead)(void *, TR_Event); -typedef void (* fptr_TR_commManagerShutdownWrite)(void *, TR_Event); +typedef TR_EventDone (* fptr_TR_commManagerAddEndpoint)(void *, TR_CommEndPoint); +typedef TR_EventDone (* fptr_TR_commManagerSelect)(void *, TR_Event, int); +typedef TR_EventDone (* fptr_TR_commManagerEnableWrite)(void *, TR_Event); +typedef TR_EventDone (* fptr_TR_commManagerDisableWrite)(void *, TR_Event); +typedef TR_EventDone (* fptr_TR_commManagerClose)(void *, TR_Event); +typedef TR_EventDone (* fptr_TR_commManagerShutdownRead)(void *, TR_Event); +typedef TR_EventDone (* fptr_TR_commManagerShutdownWrite)(void *, TR_Event); TR_INTERFACE(TR_CommManager) { TR_IFID; diff --git a/src/comm_manager.c b/src/comm_manager.c index 25500e7..7869dd1 100644 --- a/src/comm_manager.c +++ b/src/comm_manager.c @@ -85,47 +85,40 @@ commManagerCvInit(TR_class_ptr cls) TR_EventDispatcher, TR_DISPATCHER_EVENT_DATA_WAIT, TR_commManagerSelect); - TR_EVENT_HANDLER_SET_METHOD( cls, TR_EventDispatcher, TR_DISPATCHER_EVENT_SHUTDOWN, TR_commManagerShutdown); - TR_EVENT_HANDLER_SET_METHOD( cls, TR_Connection, TR_CON_EVENT_NEW_CON, TR__commManagerAddEndpoint); - TR_EVENT_HANDLER_SET_METHOD( cls, - TR_Connection, + TR_CommEndPoint, TR_CEP_EVENT_PENDING_DATA, TR_commManagerEnableWrite); - TR_EVENT_HANDLER_SET_METHOD( cls, - TR_Connection, + TR_CommEndPoint, TR_CEP_EVENT_END_DATA, TR_commManagerDisableWrite); - TR_EVENT_HANDLER_SET_METHOD( cls, TR_CommEndPoint, TR_CEP_EVENT_CLOSE, TR_commManagerClose); - TR_EVENT_HANDLER_SET_METHOD( cls, TR_CommEndPoint, TR_CEP_EVENT_SHUT_READ, TR_commManagerShutdownRead); - TR_EVENT_HANDLER_SET_METHOD( cls, TR_CommEndPoint, - TR_CEP_EVENT_SHUT_READ, + TR_CEP_EVENT_SHUT_WRITE, TR_commManagerShutdownWrite); } diff --git a/src/io_handler.c b/src/io_handler.c index 88adfb0..d72c2c9 100644 --- a/src/io_handler.c +++ b/src/io_handler.c @@ -44,14 +44,12 @@ static TR_EventDone ioHandlerRead(void * _this, TR_Event event) { - TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject; - - switch (TR_cepBufferRead(endpoint)) { + switch (TR_cepBufferRead((TR_CommEndPoint)event->subject)) { default: case FALSE: break; - case -1: + case -1: // error TR_eventHandlerIssueEvent( (TR_EventHandler)_this, TR_eventSubjectEmit( @@ -60,7 +58,7 @@ ioHandlerRead(void * _this, TR_Event event) NULL)); break; - case -2: + case -2: // remote close TR_eventHandlerIssueEvent( (TR_EventHandler)_this, TR_eventSubjectEmit(