diff --git a/testers/testserver.c b/testers/testserver.c index 881f16f..1c4bfc6 100644 --- a/testers/testserver.c +++ b/testers/testserver.c @@ -1,5 +1,6 @@ #include #include +#include #include "trbase.h" #include "trcomm.h" @@ -15,16 +16,17 @@ TR_CLASSVARS_DECL(TestHandler) { }; static -int +TR_EventDone testHandlerHeartbeat(TR_EventHandler this, TR_Event event) { printf("handled: %llu/s\n", ((TestHandler)this)->handled); ((TestHandler)this)->handled = 0; - return FALSE; + + return TR_EVENT_DONE; } static -int +TR_EventDone testHandlerNewMessage(TR_EventHandler this, TR_Event event) { TR_ProtoMessageRaw msg = event->data; @@ -43,27 +45,30 @@ testHandlerNewMessage(TR_EventHandler this, TR_Event event) TR_eventHandlerIssueEvent( (TR_EventHandler)this, - event->subject, - TR_CEP_EVENT_SEND_MSG, - event->data); + TR_eventSubjectEmit( + event->subject, + TR_CEP_EVENT_SEND_MSG, + event->data)); - return FALSE; + return TR_EVENT_DONE; } static -int +TR_EventDone testHandlerClose(TR_EventHandler this, TR_Event event) { puts("close"); - return FALSE; + + return TR_EVENT_PENDING; } static -int +TR_EventDone testHandlerUpgrade(TR_EventHandler this, TR_Event event) { - puts("upgrade"); - return FALSE; + printf("upgrade: %"PRIdPTR"\n", event->id); + + return TR_EVENT_PENDING; } static @@ -99,12 +104,12 @@ testHandlerCvInit(TR_class_ptr class) testHandlerNewMessage); TR_EVENT_HANDLER_SET_METHOD( class, - TR_EventDispatcher, + TR_CommEndPoint, TR_CEP_EVENT_CLOSE, testHandlerClose); TR_EVENT_HANDLER_SET_METHOD( class, - TR_EventDispatcher, + TR_CommEndPoint, TR_CEP_EVENT_UPGRADE, testHandlerUpgrade); }