|
|
@ -11,7 +11,7 @@ static |
|
|
TR_EventDone |
|
|
TR_EventDone |
|
|
testHandlerHeartbeat(TR_EventHandler this, TR_Event event) |
|
|
testHandlerHeartbeat(TR_EventHandler this, TR_Event event) |
|
|
{ |
|
|
{ |
|
|
printf("%zd beats since last beat / handled: %llu/s\n", |
|
|
|
|
|
|
|
|
printf("%zd beat(s) since last beat / handled: %llu/s\n", |
|
|
((TR_EventDispatcher)event->subject)->n_beats, |
|
|
((TR_EventDispatcher)event->subject)->n_beats, |
|
|
((TestHandler)this)->handled); |
|
|
((TestHandler)this)->handled); |
|
|
((TestHandler)this)->handled = 0; |
|
|
((TestHandler)this)->handled = 0; |
|
|
@ -23,22 +23,10 @@ static |
|
|
TR_EventDone |
|
|
TR_EventDone |
|
|
testHandlerNewMessage(TR_EventHandler this, TR_Event event) |
|
|
testHandlerNewMessage(TR_EventHandler this, TR_Event event) |
|
|
{ |
|
|
{ |
|
|
// TR_ProtoMessageRaw msg = event->data; |
|
|
|
|
|
// TR_SizedData data = (TR_SizedData)msg->data; |
|
|
|
|
|
// char buf[data->size + 1]; |
|
|
|
|
|
// int i; |
|
|
|
|
|
TR_Event _event; |
|
|
TR_Event _event; |
|
|
|
|
|
|
|
|
((TestHandler)this)->handled++; |
|
|
((TestHandler)this)->handled++; |
|
|
|
|
|
|
|
|
// printf("handled data %p\n", event->data); |
|
|
|
|
|
// memcpy(buf, data->data, data->size); |
|
|
|
|
|
// buf[data->size] = 0; |
|
|
|
|
|
// for (i = 0; buf[i]; i++) { |
|
|
|
|
|
// if (! isprint(buf[i])) buf[i] = '.'; |
|
|
|
|
|
// } |
|
|
|
|
|
// printf("echo message: %s(%zd)\n", buf, data->size); |
|
|
|
|
|
|
|
|
|
|
|
_event = TR_eventSubjectEmit( |
|
|
_event = TR_eventSubjectEmit( |
|
|
event->subject, |
|
|
event->subject, |
|
|
TR_CEP_EVENT_MSG_READY, |
|
|
TR_CEP_EVENT_MSG_READY, |
|
|
@ -58,14 +46,16 @@ testHandlerClose(TR_EventHandler this, TR_Event event) |
|
|
return TR_EVENT_PENDING; |
|
|
return TR_EVENT_PENDING; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//static |
|
|
|
|
|
//TR_EventDone |
|
|
|
|
|
//testHandlerUpgrade(TR_EventHandler this, TR_Event event) |
|
|
|
|
|
//{ |
|
|
|
|
|
// printf("upgrade: %"PRIdPTR"\n", event->id); |
|
|
|
|
|
// |
|
|
|
|
|
// return TR_EVENT_PENDING; |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
static |
|
|
|
|
|
TR_EventDone |
|
|
|
|
|
testHandlerUpgrade(TR_EventHandler this, TR_Event event) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("upgrade: %"PRIdPTR"\n", event->id); |
|
|
|
|
|
|
|
|
|
|
|
return TR_EVENT_PENDING; |
|
|
|
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
int |
|
|
int |
|
|
@ -103,11 +93,13 @@ testHandlerCvInit(TR_class_ptr class) |
|
|
TR_CommEndPoint, |
|
|
TR_CommEndPoint, |
|
|
TR_CEP_EVENT_CLOSE, |
|
|
TR_CEP_EVENT_CLOSE, |
|
|
testHandlerClose); |
|
|
testHandlerClose); |
|
|
// TR_EVENT_HANDLER_SET_METHOD( |
|
|
|
|
|
// class, |
|
|
|
|
|
// TR_CommEndPoint, |
|
|
|
|
|
// TR_CEP_EVENT_UPGRADE, |
|
|
|
|
|
// testHandlerUpgrade); |
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
TR_EVENT_HANDLER_SET_METHOD( |
|
|
|
|
|
class, |
|
|
|
|
|
TR_CommEndPoint, |
|
|
|
|
|
TR_CEP_EVENT_UPGRADE, |
|
|
|
|
|
testHandlerUpgrade); |
|
|
|
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TR_INSTANCE(TR_Hash, testHandlerEventMethods); |
|
|
TR_INSTANCE(TR_Hash, testHandlerEventMethods); |
|
|
|