Browse Source

use explicit event done return type in all handler methods

1.0.0
Georg Hopp 11 years ago
parent
commit
48ef354366
  1. 2
      include/tr/comm_manager.h
  2. 17
      src/comm_manager.c
  3. 4
      src/comm_manager_shutdown.c
  4. 4
      src/connector.c
  5. 27
      src/i_comm_manager.c
  6. 8
      src/io_handler.c
  7. 12
      src/protocol_handler.c

2
include/tr/comm_manager.h

@ -43,7 +43,7 @@ TR_CLASSVARS_DECL(TR_CommManager) {
};
void TR_commManagerAddEndpoint(void *, TR_CommEndPoint);
int TR_commManagerShutdown(void * _this, TR_Event event);
TR_EventDone TR_commManagerShutdown(void * _this, TR_Event event);
#endif // __TR_COMM_MANAGER_H__

17
src/comm_manager.c

@ -59,21 +59,22 @@ commManagerDtor(void * _this)
}
static
int
TR_EventDone
TR__commManagerAddEndpoint(void * _this, TR_Event event)
{
TR_commManagerAddEndpoint(
(TR_CommManager)_this,
(TR_CommEndPoint)event->subject);
return 1;
return TR_EVENT_DONE;
}
void TR_commManagerSelect(void *, TR_Event, int);
void TR_commManagerEnableWrite(void *, TR_Event);
void TR_commManagerDisableWrite(void *, TR_Event);
void TR_commManagerClose(void *, TR_Event);
void TR_commManagerShutdownRead(void *, TR_Event);
void TR_commManagerShutdownWrite(void *, TR_Event);
TR_EventDone TR_commManagerSelect(void *, TR_Event, int);
TR_EventDone TR_commManagerEnableWrite(void *, TR_Event);
TR_EventDone TR_commManagerDisableWrite(void *, TR_Event);
TR_EventDone TR_commManagerClose(void *, TR_Event);
TR_EventDone TR_commManagerShutdownRead(void *, TR_Event);
TR_EventDone TR_commManagerShutdownWrite(void *, TR_Event);
static
void

4
src/comm_manager_shutdown.c

@ -28,7 +28,7 @@
#include "tr/comm_manager.h"
int
TR_EventDone
TR_commManagerShutdown(void * _this, TR_Event event)
{
TR_CommManager this = _this;
@ -45,7 +45,7 @@ TR_commManagerShutdown(void * _this, TR_Event event)
}
}
return 0;
return TR_EVENT_DONE;
}
// vim: set ts=4 sw=4:

4
src/connector.c

@ -50,7 +50,7 @@ connectorDtor(void * _this)
}
static
int
TR_EventDone
connectorAccept(void * _this, TR_Event event)
{
TR_Connector this = _this;
@ -78,7 +78,7 @@ connectorAccept(void * _this, TR_Event event)
* TODO we need to identify socket failures and close socket then.
*/
return 1;
return TR_EVENT_DONE;
}
static

27
src/i_comm_manager.c

@ -47,7 +47,7 @@ TR_commManagerAddEndpoint(void * _this, TR_CommEndPoint endpoint)
TR_CALL(_this, TR_CommManager, addEndpoint, endpoint);
}
int
TR_EventDone
TR_commManagerSelect(void * _this, TR_Event event)
{
int timeout; // milliseconds
@ -62,17 +62,19 @@ TR_commManagerSelect(void * _this, TR_Event event)
}
TR_CALL(_this, TR_CommManager, select, event, timeout);
return 1;
return TR_EVENT_DONE;
}
int
TR_EventDone
TR_commManagerEnableWrite(void * _this, TR_Event event)
{
TR_CALL(_this, TR_CommManager, enableWrite, event);
return 1;
return TR_EVENT_DONE;
}
int
TR_EventDone
TR_commManagerDisableWrite(void * _this, TR_Event event)
{
TR_EventHandler this = _this;
@ -89,10 +91,10 @@ TR_commManagerDisableWrite(void * _this, TR_Event event)
NULL));
}
return 1;
return TR_EVENT_DONE;
}
int
TR_EventDone
TR_commManagerClose(void * _this, TR_Event event)
{
TR_CommManager this = _this;
@ -102,10 +104,10 @@ TR_commManagerClose(void * _this, TR_Event event)
TR_CALL(_this, TR_CommManager, close, event);
TR_delete(this->endpoints[endpoint->transport->handle]);
return 0;
return TR_EVENT_DONE;
}
int
TR_EventDone
TR_commManagerShutdownRead(void * _this, TR_Event event)
{
TR_CALL(_this, TR_CommManager, shutdownRead, event);
@ -130,10 +132,10 @@ TR_commManagerShutdownRead(void * _this, TR_Event event)
TR_cepSetClose((TR_CommEndPoint)event->subject);
}
return 0;
return TR_EVENT_DONE;
}
int
TR_EventDone
TR_commManagerShutdownWrite(void * _this, TR_Event event)
{
TR_CALL(_this, TR_CommManager, shutdownWrite, event);
@ -147,8 +149,7 @@ TR_commManagerShutdownWrite(void * _this, TR_Event event)
NULL));
}
return 0;
return TR_EVENT_DONE;
}
// vim: set ts=4 sw=4:

8
src/io_handler.c

@ -41,7 +41,7 @@ ioHandlerCtor(void * _this, va_list * params)
static void ioHandlerDtor(void * _this) {}
static
int
TR_EventDone
ioHandlerRead(void * _this, TR_Event event)
{
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
@ -79,11 +79,11 @@ ioHandlerRead(void * _this, TR_Event event)
break;
}
return TRUE;
return TR_EVENT_DONE;
}
static
int
TR_EventDone
ioHandlerWrite(void * _this, TR_Event event)
{
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
@ -106,7 +106,7 @@ ioHandlerWrite(void * _this, TR_Event event)
TR_eventHandlerIssueEvent((TR_EventHandler)_this, event);
}
return TRUE;
return TR_EVENT_DONE;
}
static

12
src/protocol_handler.c

@ -44,7 +44,7 @@ protocolHandlerCtor(void * _this, va_list * params)
static void protocolHandlerDtor(void * _this) {}
static
int
TR_EventDone
protocolHandlerParse(void * _this, TR_Event event)
{
/**
@ -68,11 +68,11 @@ protocolHandlerParse(void * _this, TR_Event event)
}
}
return TRUE;
return TR_EVENT_DONE;
}
static
int
TR_EventDone
protocolHandlerCompose(void * _this, TR_Event event)
{
TR_CommEndPoint endpoint = (TR_CommEndPoint)event->subject;
@ -94,13 +94,13 @@ protocolHandlerCompose(void * _this, TR_Event event)
TR_delete(message);
}
return TRUE;
return TR_EVENT_DONE;
}
int
TR_EventDone
protocolHandlerUpgrade(void * _this, TR_Event event)
{
return TRUE;
return TR_EVENT_DONE;
}
static

Loading…
Cancel
Save